/**
  * @param \TYPO3\FLOW3\Security\Account $account
  * @param array $password
  * @FLOW3\Validate(argumentName="password", type="\TYPO3\TYPO3\Validation\Validator\PasswordValidator", options={ "allowEmpty"=1, "minimum"=1, "maximum"=255 })
  * @return void
  * @todo Handle validation errors for account (accountIdentifier) & check if there's another account with the same accountIdentifier when changing it
  * @todo Security
  */
 public function updateAction(\TYPO3\FLOW3\Security\Account $account, array $password = array())
 {
     $password = array_shift($password);
     if (strlen(trim(strval($password))) > 0) {
         $account->setCredentialsSource($this->hashService->hashPassword($password, 'default'));
     }
     $this->accountRepository->update($account);
     $this->partyRepository->update($account->getParty());
     $this->addFlashMessage('The user profile has been updated.');
     $this->redirect('index');
 }
 /**
  * Remove a role from a user
  *
  * @param string $username Email address of the user
  * @param string $role Role ot be removed from the user
  * @return void
  */
 public function removeRoleCommand($username, $role)
 {
     $account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($username, 'Typo3BackendProvider');
     if (!$account instanceof \TYPO3\FLOW3\Security\Account) {
         $this->outputLine('User "%s" does not exists.', array($username));
         $this->quit(1);
     }
     $role = new \TYPO3\FLOW3\Security\Policy\Role($role);
     if (!$account->hasRole($role)) {
         $this->outputLine('User "%s" does not have the role "%s" assigned.', array($username, $role));
         $this->quit(1);
     }
     $account->removeRole($role);
     $this->accountRepository->update($account);
     $this->outputLine('Removed role "%s" from user "%s".', array($role, $username));
 }
Exemplo n.º 3
0
 /**
  *
  * @param \Planetflow3\Domain\Model\User $object
  */
 public function update($object)
 {
     $this->accountRepository->update($object->getPrimaryAccount());
     parent::update($object);
 }