Defines the node access view cache context service.
Cache context ID: 'user.node_grants' (to vary by all operations' grants). Calculated cache context ID: 'user.node_grants:%operation', e.g. 'user.node_grants:view' (to vary by the view operation's grants).
This allows for node access grants-sensitive caching when listing nodes.
Hierarchy
- class \Drupal\Core\Cache\Context\UserCacheContextBase
- class \Drupal\node\Cache\NodeAccessGrantsCacheContext implements CalculatedCacheContextInterface
See also
node_query_node_access_alter()
Related topics
- Node access rights
- The node access system determines who can do what to which nodes.
File
- core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php, line 21
Namespace
Drupal\node\Cache
Members
Name | Modifiers | Type | Description |
---|---|---|---|
NodeAccessGrantsCacheContext::checkNodeGrants | protected | function | Checks the node grants for the given operation. |
NodeAccessGrantsCacheContext::getCacheableMetadata | public | function | Gets the cacheability metadata for the context based on the parameter value. Overrides CalculatedCacheContextInterface::getCacheableMetadata |
NodeAccessGrantsCacheContext::getContext | public | function | Returns the string representation of the cache context. Overrides CalculatedCacheContextInterface::getContext |
NodeAccessGrantsCacheContext::getLabel | public static | function | Returns the label of the cache context. Overrides CalculatedCacheContextInterface::getLabel |
UserCacheContextBase::$user | protected | property | The account object. |
UserCacheContextBase::__construct | public | function | Constructs a new UserCacheContextBase class. |
Please login to continue.