function node_access_grants
Same name and namespace in other branches
- 11.x core/modules/node/node.module \node_access_grants()
- 10 core/modules/node/node.module \node_access_grants()
- 9 core/modules/node/node.module \node_access_grants()
- 8.9.x core/modules/node/node.module \node_access_grants()
- 7.x modules/node/node.module \node_access_grants()
Fetches an array of permission IDs granted to the given user ID.
The implementation here provides only the universal "all" grant. A node access module should implement hook_node_grants() to provide a grant list for the user.
After the default grants have been loaded, we allow modules to alter the grants array by reference. This hook allows for complex business logic to be applied when integrating multiple node access modules.
Parameters
string $operation: The operation that the user is trying to perform.
\Drupal\Core\Session\AccountInterface $account: The account object for the user performing the operation.
Return value
array An associative array in which the keys are realms, and the values are arrays of grants for those realms.
Deprecated
in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal::service('Drupal\node\NodeGrantsHelper')->nodeAccessGrants() instead.
See also
https://www.drupal.org/node/3578055
File
-
core/
modules/ node/ node.module, line 132
Code
function node_access_grants($operation, AccountInterface $account) {
@trigger_error('node_access_grants() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal::service(\'Drupal\\node\\NodeGrantsHelper\')->nodeAccessGrants(). See https://www.drupal.org/node/3578055', E_USER_DEPRECATED);
return \Drupal::service(NodeGrantsHelper::class)->nodeAccessGrants($operation, $account);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.