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

Breadcrumb

  1. Drupal Core 11.1.x

AccessPolicyBase.php

Namespace

Drupal\Core\Session

File

core/lib/Drupal/Core/Session/AccessPolicyBase.php

View source
<?php

namespace Drupal\Core\Session;


/**
 * Base class for access policies.
 */
abstract class AccessPolicyBase implements AccessPolicyInterface {
    
    /**
     * {@inheritdoc}
     */
    public function applies(string $scope) : bool {
        return $scope === AccessPolicyInterface::SCOPE_DRUPAL;
    }
    
    /**
     * {@inheritdoc}
     */
    public function calculatePermissions(AccountInterface $account, string $scope) : RefinableCalculatedPermissionsInterface {
        return (new RefinableCalculatedPermissions())->addCacheContexts($this->getPersistentCacheContexts());
    }
    
    /**
     * {@inheritdoc}
     */
    public function alterPermissions(AccountInterface $account, string $scope, RefinableCalculatedPermissionsInterface $calculated_permissions) : void {
    }
    
    /**
     * {@inheritdoc}
     */
    public function getPersistentCacheContexts() : array {
        return [];
    }

}

Classes

Title Deprecated Summary
AccessPolicyBase Base class for access policies.

API Navigation

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