PHP Class Sulu\Bundle\SecurityBundle\UserManager\UserManager

Inheritance: implements Sulu\Bundle\AdminBundle\UserManager\UserManagerInterface, use trait Sulu\Component\Persistence\RelationTrait
ファイルを表示 Open project: sulu/sulu

Protected Properties

Property Type Description
$contactManager Sulu\Bundle\ContactBundle\Contact\ContactManager
$em Doctrine\Common\Persistence\ObjectManager
$userRepository Sulu\Component\Security\Authentication\UserRepositoryInterface

Public Methods

Method Description
__construct ( Doctrine\Common\Persistence\ObjectManager $em, Symfony\Component\Security\Core\Encoder\EncoderFactory $encoderFactory = null, RoleRepository $roleRepository = null, GroupRepository $groupRepository = null, ContactManager $contactManager = null, SaltGenerator $saltGenerator = null, Sulu\Component\Security\Authentication\UserRepositoryInterface $userRepository = null )
delete ( ) : Closure Deletes a user with the given id.
enableUser ( integer $id ) : Sulu\Component\Security\Authentication\UserInterface
findAll ( ) : array Return all users.
findUserByContact ( integer $contactId ) : Sulu\Component\Security\Authentication\UserInterface Finds a user for a given contact id.
findUsersByAccount ( integer $accountId, $sortBy = [] ) : array Finds all users for the given account.
getFullNameByUserId ( integer $id ) : string returns fullName for given id.
getUserById ( integer $id ) : Sulu\Component\Security\Authentication\UserInterface Returns user for given id.
getUsernameByUserId ( integer $id ) : string Returns username for given id.
isEmailUnique ( string $email ) : boolean Checks if an email-adress is unique Null and empty will always return false.
isUsernameUnique ( string $username ) : boolean Checks if a username is unique Null and empty will always return false.
isValidPassword ( string $password ) : boolean Checks if the given password is a valid one.
processUserRoles ( Sulu\Component\Security\Authentication\UserInterface $user, array $userRoles ) : boolean Process all user roles from request.
save ( array $data, string $locale, null | integer $id = null, boolean $patch = false, boolean $flush = true ) : null | Sulu\Component\Security\Authentication\UserInterface Creates a new user with the given data.

Protected Methods

Method Description
processUserGroups ( Sulu\Component\Security\Authentication\UserInterface $user, $userGroups ) : boolean Process all user groups from request.

Private Methods

Method Description
addUserGroup ( Sulu\Component\Security\Authentication\UserInterface $user, $userGroupData ) : boolean Adds a new UserGroup to the given user.
addUserRole ( Sulu\Component\Security\Authentication\UserInterface $user, $userRoleData ) : boolean Adds a new UserRole to the given user.
encodePassword ( Sulu\Component\Security\Authentication\UserInterface $user, string $password, string $salt ) : string Encodes the given password, for the given passwort, with he given salt and returns the result.
generateSalt ( ) : string Generates a random salt for the password.
getContact ( integer $id ) : Contact Returns the contact with the given id.
getProperty ( array $data, string $key, string $default = null ) : string | null Return property for key or given default value.
processEmail ( Sulu\Component\Security\Authentication\UserInterface $user, string $email, null | array $contact = null ) Processes the email and adds it to the user.
resetIndexOfSubentites ( mixed $entities ) : mixed this is just a hack to avoid relations that start with index != 0 otherwise deserialization process will parse relations as object instead of an array reindex entities.
updateUserGroup ( UserGroup $userGroup, $userGroupData ) : boolean Updates an existing UserGroup with the given data.
updateUserRole ( Sulu\Bundle\SecurityBundle\Entity\UserRole $userRole, $userRoleData ) : boolean Updates an existing UserRole with the given data.

Method Details

__construct() public method

public __construct ( Doctrine\Common\Persistence\ObjectManager $em, Symfony\Component\Security\Core\Encoder\EncoderFactory $encoderFactory = null, RoleRepository $roleRepository = null, GroupRepository $groupRepository = null, ContactManager $contactManager = null, SaltGenerator $saltGenerator = null, Sulu\Component\Security\Authentication\UserRepositoryInterface $userRepository = null )
$em Doctrine\Common\Persistence\ObjectManager
$encoderFactory Symfony\Component\Security\Core\Encoder\EncoderFactory
$roleRepository Sulu\Bundle\SecurityBundle\Entity\RoleRepository
$groupRepository Sulu\Bundle\SecurityBundle\Entity\GroupRepository
$contactManager Sulu\Bundle\ContactBundle\Contact\ContactManager
$saltGenerator Sulu\Component\Security\Authentication\SaltGenerator
$userRepository Sulu\Component\Security\Authentication\UserRepositoryInterface

delete() public method

Deletes a user with the given id.
public delete ( ) : Closure
return Closure

enableUser() public method

public enableUser ( integer $id ) : Sulu\Component\Security\Authentication\UserInterface
$id integer
return Sulu\Component\Security\Authentication\UserInterface

findAll() public method

Return all users.
public findAll ( ) : array
return array

findUserByContact() public method

Finds a user for a given contact id.
public findUserByContact ( integer $contactId ) : Sulu\Component\Security\Authentication\UserInterface
$contactId integer
return Sulu\Component\Security\Authentication\UserInterface

findUsersByAccount() public method

Finds all users for the given account.
public findUsersByAccount ( integer $accountId, $sortBy = [] ) : array
$accountId integer
return array

getFullNameByUserId() public method

returns fullName for given id.
public getFullNameByUserId ( integer $id ) : string
$id integer userId
return string

getUserById() public method

Returns user for given id.
public getUserById ( integer $id ) : Sulu\Component\Security\Authentication\UserInterface
$id integer userId
return Sulu\Component\Security\Authentication\UserInterface

getUsernameByUserId() public method

Returns username for given id.
public getUsernameByUserId ( integer $id ) : string
$id integer userId
return string

isEmailUnique() public method

Checks if an email-adress is unique Null and empty will always return false.
public isEmailUnique ( string $email ) : boolean
$email string
return boolean

isUsernameUnique() public method

Checks if a username is unique Null and empty will always return false.
public isUsernameUnique ( string $username ) : boolean
$username string
return boolean

isValidPassword() public method

Checks if the given password is a valid one.
public isValidPassword ( string $password ) : boolean
$password string The password to check
return boolean True if the password is valid, otherwise false

processUserGroups() protected method

Process all user groups from request.
protected processUserGroups ( Sulu\Component\Security\Authentication\UserInterface $user, $userGroups ) : boolean
$user Sulu\Component\Security\Authentication\UserInterface
$userGroups
return boolean True if the processing was successful, otherwise false

processUserRoles() public method

Process all user roles from request.
public processUserRoles ( Sulu\Component\Security\Authentication\UserInterface $user, array $userRoles ) : boolean
$user Sulu\Component\Security\Authentication\UserInterface
$userRoles array
return boolean True if the processing was successful, otherwise false

save() public method

Creates a new user with the given data.
public save ( array $data, string $locale, null | integer $id = null, boolean $patch = false, boolean $flush = true ) : null | Sulu\Component\Security\Authentication\UserInterface
$data array
$locale string
$id null | integer
$patch boolean
$flush boolean
return null | Sulu\Component\Security\Authentication\UserInterface

Property Details

$contactManager protected_oe property

protected ContactManager,Sulu\Bundle\ContactBundle\Contact $contactManager
return Sulu\Bundle\ContactBundle\Contact\ContactManager

$em protected_oe property

protected ObjectManager,Doctrine\Common\Persistence $em
return Doctrine\Common\Persistence\ObjectManager

$userRepository protected_oe property

protected UserRepositoryInterface,Sulu\Component\Security\Authentication $userRepository
return Sulu\Component\Security\Authentication\UserRepositoryInterface