class SuperUserAccessPolicy
Same name in other branches
- 10 core/lib/Drupal/Core/Session/SuperUserAccessPolicy.php \Drupal\Core\Session\SuperUserAccessPolicy
Grants user 1 an all access pass.
Hierarchy
- class \Drupal\Core\Session\AccessPolicyBase implements \Drupal\Core\Session\AccessPolicyInterface
- class \Drupal\Core\Session\SuperUserAccessPolicy extends \Drupal\Core\Session\AccessPolicyBase
Expanded class hierarchy of SuperUserAccessPolicy
1 file declares its use of SuperUserAccessPolicy
- SuperUserAccessPolicyTest.php in core/
tests/ Drupal/ Tests/ Core/ Session/ SuperUserAccessPolicyTest.php
File
-
core/
lib/ Drupal/ Core/ Session/ SuperUserAccessPolicy.php, line 10
Namespace
Drupal\Core\SessionView source
final class SuperUserAccessPolicy extends AccessPolicyBase {
/**
* {@inheritdoc}
*/
public function calculatePermissions(AccountInterface $account, string $scope) : RefinableCalculatedPermissionsInterface {
$calculated_permissions = parent::calculatePermissions($account, $scope);
if ((int) $account->id() !== 1) {
return $calculated_permissions;
}
return $calculated_permissions->addItem(new CalculatedPermissionsItem([], TRUE));
}
/**
* {@inheritdoc}
*/
public function getPersistentCacheContexts() : array {
return [
'user.is_super_user',
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
AccessPolicyBase::alterPermissions | public | function | Alter the permissions after all policies have finished building them. | Overrides AccessPolicyInterface::alterPermissions | 2 |
AccessPolicyBase::applies | public | function | Checks whether this access policy applies to a given scope. | Overrides AccessPolicyInterface::applies | 7 |
AccessPolicyInterface::SCOPE_DRUPAL | constant | Scope ID for general Drupal access. | |||
SuperUserAccessPolicy::calculatePermissions | public | function | Calculates the permissions for an account within a given scope. | Overrides AccessPolicyBase::calculatePermissions | |
SuperUserAccessPolicy::getPersistentCacheContexts | public | function | Gets the persistent cache contexts. | Overrides AccessPolicyBase::getPersistentCacheContexts |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.