/**
  * Returns TRUE, if the given property ($value) is a valid array consistent of two equal passwords and their length
  * is between 'minimum' (defaults to 0 if not specified) and 'maximum' (defaults to infinite if not specified)
  * to be specified in the validation options.
  *
  * If at least one error occurred, the result is FALSE.
  *
  * @param mixed $value The value that should be validated
  * @return void
  * @throws \TYPO3\FLOW3\Validation\Exception\InvalidSubjectException
  */
 protected function isValid($value)
 {
     if (!is_string($value)) {
         throw new \TYPO3\FLOW3\Validation\Exception\InvalidSubjectException('The given value was not a string.', 1325155784);
     }
     $authenticationProviderName = isset($this->options['authenticationProviderName']) ? $this->options['authenticationProviderName'] : 'Typo3BackendProvider';
     $account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($value, $authenticationProviderName);
     if ($account !== NULL) {
         $this->addError('The username is already in use.', 1325156008);
     }
 }
 /**
  * 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));
 }