protected NodeAccessGrantsCacheContext::checkNodeGrants($operation)
Checks the node grants for the given operation.
Parameters
string $operation: The operation to check the node grants for.
Return value
string The string representation of the cache context.
File
- core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php, line 63
Class
- NodeAccessGrantsCacheContext
- Defines the node access view cache context service.
Namespace
Drupal\node\Cache
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | protected function checkNodeGrants( $operation ) { // When checking the grants for the 'view' operation and the current user // has a global view grant (i.e. a view grant for node ID 0) — note that // this is automatically the case if no node access modules exist (no // hook_node_grants() implementations) then we don't need to determine the // exact node view grants for the current user. if ( $operation === 'view' && node_access_view_all_nodes( $this ->user)) { return 'view.all' ; } $grants = node_access_grants( $operation , $this ->user); $grants_context_parts = []; foreach ( $grants as $realm => $gids ) { $grants_context_parts [] = $realm . ':' . implode( ',' , $gids ); } return $operation . '.' . implode( ';' , $grants_context_parts ); } |
Please login to continue.