function SuperUserAccessPolicy::calculatePermissions

Same name in other branches
  1. 10 core/lib/Drupal/Core/Session/SuperUserAccessPolicy.php \Drupal\Core\Session\SuperUserAccessPolicy::calculatePermissions()

Overrides AccessPolicyBase::calculatePermissions

File

core/lib/Drupal/Core/Session/SuperUserAccessPolicy.php, line 15

Class

SuperUserAccessPolicy
Grants user 1 an all access pass.

Namespace

Drupal\Core\Session

Code

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

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