class RoleStorage

Same name and namespace in other branches
  1. 11.x core/modules/user/src/RoleStorage.php \Drupal\user\RoleStorage
  2. 10 core/modules/user/src/RoleStorage.php \Drupal\user\RoleStorage
  3. 8.9.x core/modules/user/src/RoleStorage.php \Drupal\user\RoleStorage

Controller class for user roles.

Hierarchy

Expanded class hierarchy of RoleStorage

File

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

Namespace

Drupal\user
View source
class RoleStorage extends ConfigEntityStorage implements RoleStorageInterface {
  
  /**
   * {@inheritdoc}
   */
  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.