USER_IMAGE_FOLDER
USER_IMAGE_FOLDER = './data/media/user-images/'
This service is responsible for the logic of adding/editing users and changing user passwords by admin staff.
__construct(\AclUser\Service\Doctrine\ORM\EntityManager $entityManager, \AclUser\Service\AclUser\Mail\MailMessage $mailMessage, \AclUser\Service\Translate\Service\LanguageManager $languageManager)
Instantiate UserManager object and inject services
\AclUser\Service\Doctrine\ORM\EntityManager | $entityManager | |
\AclUser\Service\AclUser\Mail\MailMessage | $mailMessage | |
\AclUser\Service\Translate\Service\LanguageManager | $languageManager |
getUserByEmailAddress(string $email) : \AclUser\Entity\User
Find User by e-mail address
string |
getUserById(integer $id) : \AclUser\Entity\User
Find User by database id
integer | $id |
AclUser/Entity/User entity
validatePassword(\AclUser\Entity\User $user, string $password) : boolean
Checks that the given password is correct.
\AclUser\Entity\User | $user | |
string | $password |
generatePasswordResetToken(\AclUser\Entity\User $user)
Generates a password reset token and save to database for this user. This token is then stored in database and sent to the user's E-mail address. When the user clicks the link in E-mail message, he is directed to the Set Password page.
\AclUser\Entity\User | $user |
changePassword(\AclUser\Entity\User $user, array $data) : boolean
This method is used to change the password for the given user. To change the password, one must know the old password.
\AclUser\Entity\User | $user | |
array | $data |
getRoleByName(string $roleName) : \AclUser\Entity\Role
Get Role entity by role name
string | $roleName |
validateRegistrationForm(\AclUser\Form\RegistrationForm $form, array $params, boolean $withCaptcha) : \Zend\Authentication\Result
Validate
\AclUser\Form\RegistrationForm | $form | |
array | $params | post parameters |
boolean | $withCaptcha | whether user is being created by new user or admin |
sendConfirmNewAccountEmail(\AclUser\Entity\User $user, boolean $social = false)
Send e-mail when new user registers with application
\AclUser\Entity\User | $user | the newly created user |
boolean | $social | whether account was created through social provider |
validateChangePasswordForm(\AclUser\Form\ChangePasswordForm $form, array $params, \AclUser\Service\Acluser\Entity\user $user) : \Zend\Authentication\Result
Validate change password form
\AclUser\Form\ChangePasswordForm | $form | |
array | $params | |
\AclUser\Service\Acluser\Entity\user | $user |
validateResetPasswordForm(\AclUser\Form\ResetPasswordForm $form, array $params) : \Zend\Authentication\Result
Validate reset password form and complete logic as appropriate
\AclUser\Form\ResetPasswordForm | $form | |
array | $params | post parameters |
updateValidUsersPassword(\AclUser\Entity\User $user, string $password, boolean $newUser = false)
Hash password and update database with hash for this user
\AclUser\Entity\User | $user | entity object |
string | $password | un-hashed password |
boolean | $newUser | whether this a newly created entity |
activateAccountByToken(string $token) : \Zend\Authentication\Result
Check that token belongs to a user then change their status to active if it does and update pwdResetToken and date to null. Either was assign feedback messages to the returned Result object
string | $token |
validatePhotoUploadForm(boolean $isPost, \AclUser\Service\AclUser\Form\RotateAndResizeImageForm $form, \Zend\Mvc\Controller\Plugin\Params $params, integer $userId) : array
Validate user photo upload and perform transformation on same
boolean | $isPost | |
\AclUser\Service\AclUser\Form\RotateAndResizeImageForm | $form | |
\Zend\Mvc\Controller\Plugin\Params | $params | |
integer | $userId |
prepopulateUserProfile(\AclUser\Form\BasicProfileForm $form, integer $id)
Pre-populate BasicProfileForm with the existing values for user corresponding to the user id
\AclUser\Form\BasicProfileForm | $form | |
integer | $id |
validateBasicProfileForm(\AclUser\Form\BasicProfileForm $form, array $params, integer $id) : boolean
Validate posted parameters from BasicProfileForm and update user if they are valid
\AclUser\Form\BasicProfileForm | $form | |
array | $params | the post parameters |
integer | $id | the logged in user id or the id of the user being updated |
getTranslatedErrorMesssages(\AclUser\Service\Translate\Mvc\Controller\Plugin\TranslateControllerPlugin $translateContollerPlugin, array $errorMessages) : array
Translate all error messages
\AclUser\Service\Translate\Mvc\Controller\Plugin\TranslateControllerPlugin | $translateContollerPlugin | translator controller plugin |
array | $errorMessages | untranslated error messages |
of translated error messages
findUserById(integer $id) : \AclUser\Entity\User|null
Get User by their database id
integer | $id |
findRoleById(integer $id) : \AclUser\Entity\Role|null
Get Role by its database id
integer | $id |
getRolesByUser(\AclUser\Entity\User $user) : array
Get this users roles and all possible roles
\AclUser\Entity\User | $user |
of ArrayCaollections This user's Roles & All possible Roles
createNewUser(array $data, boolean $withCaptcha) : \Zend\Authentication\Result
Create System user and set messages and send e-mail depending if admin created user
array | $data | post parameters |
boolean | $withCaptcha | indicates whether admin or anon is creating user |
sendForgottenPasswordEmail(\AclUser\Entity\User $user)
Send forgotten password e-mail with reset token
\AclUser\Entity\User | $user |
checkPasswordResetTokenForUser(\AclUser\Entity\User|null $user, string $message = null) : \Zend\Authentication\Result
Check that user is not null and that their password reset token has not expired Add messages and result validity to Result depending on user status
\AclUser\Entity\User|null | $user | |
string | $message |
getUserByPasswordResetToken(string $token) : \AclUser\Entity\User|null
Get user from database by password reset token
string | $token | the password reset token |
if user is not found in database