Neos\Neos\Domain\Service\UserService::activateUser PHP Method

activateUser() public method

Reactivates the given user
public activateUser ( User $user ) : void
$user Neos\Neos\Domain\Model\User The user to deactivate
return void
    public function activateUser(User $user)
    {
        foreach ($user->getAccounts() as $account) {
            /** @var Account $account */
            $account->setExpirationDate(null);
            $this->accountRepository->update($account);
        }
        $this->emitUserActivated($user);
    }

Usage Example

 /**
  * Activate a user
  *
  * This command reactivates possibly expired accounts for the given user.
  *
  * If an authentication provider is specified, this command will look for an account with the given username related
  * to the given provider. Still, this command will activate <b>all</b> accounts of a user, once such a user has been
  * found.
  *
  * @param string $username The username of the user to be activated.
  * @param string $authenticationProvider Name of the authentication provider to use for finding the user. Example: "Typo3BackendProvider"
  * @return void
  */
 public function activateCommand($username, $authenticationProvider = null)
 {
     $user = $this->getUserOrFail($username, $authenticationProvider);
     $this->userService->activateUser($user);
     $this->outputLine('Activated user "%s".', array($username));
 }