SuperUserAccessPolicy.php
Same filename in other branches
Namespace
Drupal\Core\SessionFile
-
core/
lib/ Drupal/ Core/ Session/ SuperUserAccessPolicy.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Core\Session;
/**
* Grants user 1 an all access pass.
*/
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',
];
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
SuperUserAccessPolicy | Grants user 1 an all access pass. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.