Neos\Flow\Security\Policy\PolicyService::hasRole PHP Метод

hasRole() публичный Метод

Checks if a role exists
public hasRole ( string $roleIdentifier ) : boolean
$roleIdentifier string The role identifier, format: (:)
Результат boolean
    public function hasRole($roleIdentifier)
    {
        $this->initialize();
        return isset($this->roles[$roleIdentifier]);
    }

Usage Example

Пример #1
0
 /**
  * Initializes the roles field by fetching the role objects referenced by the roleIdentifiers
  *
  * @return void
  */
 protected function initializeRoles()
 {
     if ($this->roles !== null) {
         return;
     }
     $this->roles = [];
     foreach ($this->roleIdentifiers as $key => $roleIdentifier) {
         // check for and clean up roles no longer available
         if ($this->policyService->hasRole($roleIdentifier)) {
             $this->roles[$roleIdentifier] = $this->policyService->getRole($roleIdentifier);
         } else {
             unset($this->roleIdentifiers[$key]);
         }
     }
 }
All Usage Examples Of Neos\Flow\Security\Policy\PolicyService::hasRole