/**
  * @test
  */
 public function removeRoleSkipsRemovalIfRoleNotAssigned()
 {
     $account = new Account();
     $account->setRoles(array($this->administratorRole));
     $account->removeRole($this->customerRole);
     $this->assertCount(1, $account->getRoles());
 }
Beispiel #2
0
 /**
  * @param \Ag\Login\Domain\Model\Role $role
  */
 public function removeRole($role)
 {
     $this->login->removeRole($this->roleToFlowRole($role));
 }
 /**
  * Removes the specified role from the given account and potentially carries out further actions which are needed to
  * properly reflect these changes.
  *
  * @param Account $account The account to remove roles from
  * @param string $roleIdentifier A fully qualified role identifier, or a role identifier relative to the TYPO3.Neos namespace
  * @return integer How often this role has been removed from the given account (effectively can be 1 or 0)
  * @api
  */
 public function removeRoleFromAccount(Account $account, $roleIdentifier)
 {
     $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier);
     $role = $this->policyService->getRole($roleIdentifier);
     /** @var Account $account */
     if ($account->hasRole($role)) {
         $account->removeRole($role);
         $this->accountRepository->update($account);
         $this->emitRolesRemoved($account, array($role));
         return 1;
     }
     return 0;
 }
 /**
  * {@inheritDoc}
  */
 public function removeRole(\TYPO3\Flow\Security\Policy\Role $role)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'removeRole', array($role));
     return parent::removeRole($role);
 }