Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. InstallerAccessPolicy.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal