class CalculatedPermissions
Same name in other branches
- 11.x core/lib/Drupal/Core/Session/CalculatedPermissions.php \Drupal\Core\Session\CalculatedPermissions
Represents a calculated set of permissions with cacheable metadata.
Hierarchy
- class \Drupal\Core\Session\CalculatedPermissions implements \Drupal\Core\Session\CalculatedPermissionsInterface uses \Drupal\Core\Cache\CacheableDependencyTrait, \Drupal\Core\Session\CalculatedPermissionsTrait
Expanded class hierarchy of CalculatedPermissions
See also
\Drupal\core\Session\AccessPolicyProcessor
4 files declare their use of CalculatedPermissions
- AccessPolicyProcessorTest.php in core/
tests/ Drupal/ Tests/ Core/ Session/ AccessPolicyProcessorTest.php - CalculatedPermissionsTest.php in core/
tests/ Drupal/ Tests/ Core/ Session/ CalculatedPermissionsTest.php - PermissionCheckerTest.php in core/
tests/ Drupal/ Tests/ Core/ Session/ PermissionCheckerTest.php - PermissionsHashGeneratorTest.php in core/
tests/ Drupal/ Tests/ Core/ Session/ PermissionsHashGeneratorTest.php
File
-
core/
lib/ Drupal/ Core/ Session/ CalculatedPermissions.php, line 12
Namespace
Drupal\Core\SessionView source
class CalculatedPermissions implements CalculatedPermissionsInterface {
use CacheableDependencyTrait;
use CalculatedPermissionsTrait;
/**
* Constructs a new CalculatedPermissions.
*
* @param \Drupal\Core\Session\CalculatedPermissionsInterface $source
* The calculated permission to create a value object from.
*/
public function __construct(CalculatedPermissionsInterface $source) {
foreach ($source->getItems() as $item) {
$this->items[$item->getScope()][$item->getIdentifier()] = $item;
}
$this->setCacheability($source);
// The (persistent) cache contexts attached to the permissions are only
// used internally to store the permissions in the VariationCache. We strip
// these cache contexts when the calculated permissions get converted into a
// value object here so that they will never bubble up by accident.
$this->cacheContexts = [];
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.