You are here

public function UserPermissionsModuleSpecificForm::access in Drupal 10

Checks that at least one module defines permissions.

Parameters

string $modules: (optional) One or more module machine names, comma-separated.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

1 string reference to 'UserPermissionsModuleSpecificForm::access'
user.routing.yml in core/modules/user/user.routing.yml
core/modules/user/user.routing.yml

File

core/modules/user/src/Form/UserPermissionsModuleSpecificForm.php, line 59

Class

UserPermissionsModuleSpecificForm
Provides the user permissions administration form for one or more module(s).

Namespace

Drupal\user\Form

Code

public function access($modules) : AccessResultInterface {
  foreach (explode(',', $modules) as $module) {
    if ($this->permissionHandler
      ->moduleProvidesPermissions($module)) {
      return AccessResult::allowed();
    }
  }
  return AccessResult::forbidden();
}