function RoleStorage::isPermissionInRoles

Same name in other branches
  1. 8.9.x core/modules/user/src/RoleStorage.php \Drupal\user\RoleStorage::isPermissionInRoles()
  2. 10 core/modules/user/src/RoleStorage.php \Drupal\user\RoleStorage::isPermissionInRoles()
  3. 11.x core/modules/user/src/RoleStorage.php \Drupal\user\RoleStorage::isPermissionInRoles()

Overrides RoleStorageInterface::isPermissionInRoles

File

core/modules/user/src/RoleStorage.php, line 15

Class

RoleStorage
Controller class for user roles.

Namespace

Drupal\user

Code

public function isPermissionInRoles($permission, array $rids) {
    foreach ($this->loadMultiple($rids) as $role) {
        
        /** @var \Drupal\user\RoleInterface $role */
        if ($role->hasPermission($permission)) {
            return TRUE;
        }
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.