class BarAccessPolicy
Same name in other branches
- 11.x core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php \Drupal\Tests\Core\Session\BarAccessPolicy
Hierarchy
- class \Drupal\Core\Session\AccessPolicyBase implements \Drupal\Core\Session\AccessPolicyInterface
- class \Drupal\Tests\Core\Session\BarAccessPolicy extends \Drupal\Core\Session\AccessPolicyBase
Expanded class hierarchy of BarAccessPolicy
File
-
core/
tests/ Drupal/ Tests/ Core/ Session/ AccessPolicyProcessorTest.php, line 440
Namespace
Drupal\Tests\Core\SessionView source
class BarAccessPolicy extends AccessPolicyBase {
public function applies(string $scope) : bool {
return $scope === 'bar' || $scope === 'anything';
}
public function calculatePermissions(AccountInterface $account, string $scope) : RefinableCalculatedPermissionsInterface {
$calculated_permissions = parent::calculatePermissions($account, $scope);
return $calculated_permissions->addItem(new CalculatedPermissionsItem([
'foo',
'bar',
], FALSE, $scope, 1));
}
public function getPersistentCacheContexts() : array {
return [
'bar',
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
AccessPolicyBase::alterPermissions | public | function | Overrides AccessPolicyInterface::alterPermissions | 2 | |
AccessPolicyInterface::SCOPE_DRUPAL | constant | Scope ID for general Drupal access. | |||
BarAccessPolicy::applies | public | function | Overrides AccessPolicyBase::applies | ||
BarAccessPolicy::calculatePermissions | public | function | Overrides AccessPolicyBase::calculatePermissions | ||
BarAccessPolicy::getPersistentCacheContexts | public | function | Overrides AccessPolicyBase::getPersistentCacheContexts |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.