/** * Edit the given account * * @param Account $account * @return void */ public function editAccountAction(Account $account) { $this->view->assignMultiple(array('account' => $account, 'user' => $this->userService->getUser($account->getAccountIdentifier(), $account->getAuthenticationProviderName()))); }
/** * Update a given account * * @param Account $account The account to update * @param array $roleIdentifiers A possibly updated list of roles for the user's primary account * @param array $password Expects an array in the format array('<password>', '<password confirmation>') * @Flow\Validate(argumentName="password", type="\TYPO3\Neos\Validation\Validator\PasswordValidator", options={ "allowEmpty"=1, "minimum"=1, "maximum"=255 }) * @return void */ public function updateAccountAction(Account $account, array $roleIdentifiers, array $password = array()) { $user = $this->userService->getUser($account->getAccountIdentifier(), $account->getAuthenticationProviderName()); if ($user === $this->currentUser) { $roles = array(); foreach ($roleIdentifiers as $roleIdentifier) { $roles[$roleIdentifier] = $this->policyService->getRole($roleIdentifier); } if (!$this->privilegeManager->isPrivilegeTargetGrantedForRoles($roles, 'TYPO3.Neos:Backend.Module.Administration.Users')) { $this->addFlashMessage('With the selected roles the currently logged in user wouldn\'t have access to this module any longer. Please adjust the assigned roles!', 'Don\'t lock yourself out', Message::SEVERITY_WARNING, array(), 1416501197); $this->forward('edit', null, null, array('user' => $this->currentUser)); } } $password = array_shift($password); if (strlen(trim(strval($password))) > 0) { $this->userService->setUserPassword($user, $password); } $this->userService->setRolesForAccount($account, $roleIdentifiers); $this->addFlashMessage('The account has been updated.', 'Account updated', Message::SEVERITY_OK); $this->redirect('edit', null, null, array('user' => $user)); }
/** * {@inheritDoc} */ public function getAuthenticationProviderName() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getAuthenticationProviderName', array()); return parent::getAuthenticationProviderName(); }
/** * Checks if the given account is already in the account repository * * @param \TYPO3\Flow\Security\Account $account * @return bool */ public function doesAccountExist(\TYPO3\Flow\Security\Account $account) { $accountIdentifier = $account->getAccountIdentifier(); $authenticationProviderName = $account->getAuthenticationProviderName(); $existingAccount = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($accountIdentifier, $authenticationProviderName); return $existingAccount !== NULL; }
/** * Persists new accounts only. If account is allready persisted, then account will be overridden with account from repository. * * @param string $providerName Provider name * @param Account $account account to persist. * * @return void */ private function persistAccount($providerName, Account &$account) { $accountFromRepository = $this->accountRepository->findActiveByAccountIdentifierAndAuthenticationProviderName($account->getAccountIdentifier(), $account->getAuthenticationProviderName()); if ($accountFromRepository instanceof Account) { $account = $accountFromRepository; $this->updateRolesInAccount($providerName, $account); return; } $casAttributes = $this->casManager->getCasAttributes($providerName); $account->setRoles($this->getRoles($providerName, $casAttributes)); $this->mekeRedirectByNewUserIfNeeded($providerName, $account); $this->finalizePersistingNewUser($account); }