You are here

public function PermissionHandler::moduleProvidesPermissions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/PermissionHandler.php \Drupal\user\PermissionHandler::moduleProvidesPermissions()

Determines whether a module provides some permissions.

Parameters

string $module_name: The module name.

Return value

bool Returns TRUE if the module provides some permissions, otherwise FALSE.

Overrides PermissionHandlerInterface::moduleProvidesPermissions

File

core/modules/user/src/PermissionHandler.php, line 121
Contains \Drupal\user\PermissionHandler.

Class

PermissionHandler
Provides the available permissions based on yml files.

Namespace

Drupal\user

Code

public function moduleProvidesPermissions($module_name) {

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