PermissionHandler::moduleProvidesPermissions

public PermissionHandler::moduleProvidesPermissions($module_name)

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 116

Class

PermissionHandler
Provides the available permissions based on yml files.

Namespace

Drupal\user

Code

1
2
3
4
5
6
7
8
9
10
11
12
public function moduleProvidesPermissions($module_name) {
  // @TODO Static cache this information, see
  $permissions = $this->getPermissions();
 
  foreach ($permissions as $permission) {
    if ($permission['provider'] == $module_name) {
      return TRUE;
    }
  }
  return FALSE;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.