function PermissionHandler::moduleProvidesPermissions

Same name and namespace in other branches
  1. 9 core/modules/user/src/PermissionHandler.php \Drupal\user\PermissionHandler::moduleProvidesPermissions()
  2. 8.9.x core/modules/user/src/PermissionHandler.php \Drupal\user\PermissionHandler::moduleProvidesPermissions()
  3. 10 core/modules/user/src/PermissionHandler.php \Drupal\user\PermissionHandler::moduleProvidesPermissions()

File

core/modules/user/src/PermissionHandler.php, line 124

Class

PermissionHandler
Provides the available permissions based on yml files.

Namespace

Drupal\user

Code

public function moduleProvidesPermissions($module_name) {
    // @todo Static cache this information.
    //   https://www.drupal.org/node/2339487
    $permissions = $this->getPermissions();
    foreach ($permissions as $permission) {
        if ($permission['provider'] == $module_name) {
            return TRUE;
        }
    }
    return FALSE;
}

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