class AlwaysAltersAccessPolicy

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php \Drupal\Tests\Core\Session\AlwaysAltersAccessPolicy

Hierarchy

Expanded class hierarchy of AlwaysAltersAccessPolicy

File

core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php, line 520

Namespace

Drupal\Tests\Core\Session
View source
class AlwaysAltersAccessPolicy extends AccessPolicyBase {
    public function applies(string $scope) : bool {
        return TRUE;
    }
    public function alterPermissions(AccountInterface $account, string $scope, RefinableCalculatedPermissionsInterface $calculated_permissions) : void {
        parent::alterPermissions($account, $scope, $calculated_permissions);
        $calculated_permissions->addItem(new CalculatedPermissionsItem([
            'always',
        ], FALSE, 'always', 2));
    }
    public function getPersistentCacheContexts() : array {
        return [
            'always',
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AccessPolicyBase::calculatePermissions public function Calculates the permissions for an account within a given scope. Overrides AccessPolicyInterface::calculatePermissions 7
AccessPolicyInterface::SCOPE_DRUPAL constant Scope ID for general Drupal access.
AlwaysAltersAccessPolicy::alterPermissions public function Alter the permissions after all policies have finished building them. Overrides AccessPolicyBase::alterPermissions
AlwaysAltersAccessPolicy::applies public function Checks whether this access policy applies to a given scope. Overrides AccessPolicyBase::applies
AlwaysAltersAccessPolicy::getPersistentCacheContexts public function Gets the persistent cache contexts. Overrides AccessPolicyBase::getPersistentCacheContexts

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