function AccessPolicyProcessor::validateScope

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Session/AccessPolicyProcessor.php \Drupal\Core\Session\AccessPolicyProcessor::validateScope()

Validates if calculated permissions all match a single scope.

Parameters

string $scope: The scope to match.

\Drupal\Core\Session\CalculatedPermissionsInterface $calculated_permissions: The calculated permissions that should match the scope.

Return value

bool Whether the calculated permissions match the scope.

1 call to AccessPolicyProcessor::validateScope()
AccessPolicyProcessor::processAccessPolicies in core/lib/Drupal/Core/Session/AccessPolicyProcessor.php
Processes the access policies for an account within a given scope.

File

core/lib/Drupal/Core/Session/AccessPolicyProcessor.php, line 198

Class

AccessPolicyProcessor
Processes access policies into permissions for an account.

Namespace

Drupal\Core\Session

Code

protected function validateScope(string $scope, CalculatedPermissionsInterface $calculated_permissions) : bool {
    $actual_scopes = $calculated_permissions->getScopes();
    return empty($actual_scopes) || $actual_scopes === [
        $scope,
    ];
}

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