function UserPermissionsModuleSpecificForm::access

Same name in other branches
  1. 9 core/modules/user/src/Form/UserPermissionsModuleSpecificForm.php \Drupal\user\Form\UserPermissionsModuleSpecificForm::access()
  2. 10 core/modules/user/src/Form/UserPermissionsModuleSpecificForm.php \Drupal\user\Form\UserPermissionsModuleSpecificForm::access()

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();
}

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