
| Current Path : /var/www/html/recommended-project/web/core/lib/Drupal/Core/Session/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/recommended-project/web/core/lib/Drupal/Core/Session/CalculatedPermissions.php |
<?php
namespace Drupal\Core\Session;
use Drupal\Core\Cache\CacheableDependencyTrait;
/**
* Represents a calculated set of permissions with cacheable metadata.
*
* @see \Drupal\core\Session\AccessPolicyProcessor
*/
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 = [];
}
}