function InstallerAccessPolicy::calculatePermissions

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Installer/InstallerAccessPolicy.php \Drupal\Core\Installer\InstallerAccessPolicy::calculatePermissions()

Overrides AccessPolicyBase::calculatePermissions

File

core/lib/Drupal/Core/Installer/InstallerAccessPolicy.php, line 21

Class

InstallerAccessPolicy
Grants user 1 an all access pass during install.

Namespace

Drupal\Core\Installer

Code

public function calculatePermissions(AccountInterface $account, string $scope) : RefinableCalculatedPermissionsInterface {
    $calculated_permissions = parent::calculatePermissions($account, $scope);
    // Prevent the access policy from working when not in the installer.
    if ((int) $account->id() !== 1 || !InstallerKernel::installationAttempted()) {
        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.