8.5.x node.module node_access_grants($op, AccountInterface $account)
8.0.x node.module node_access_grants($op, AccountInterface $account)
8.1.x node.module node_access_grants($op, AccountInterface $account)
8.2.x node.module node_access_grants($op, AccountInterface $account)
8.3.x node.module node_access_grants($op, AccountInterface $account)
8.4.x node.module node_access_grants($op, AccountInterface $account)
8.6.x node.module node_access_grants($op, AccountInterface $account)
4.6.x node.module node_access_grants($op, $uid = NULL)
4.7.x node.module node_access_grants($op, $uid = NULL)
5.x node.module node_access_grants($op, $uid = NULL)
6.x node.module node_access_grants($op, $account = NULL)
7.x node.module node_access_grants($op, $account = NULL)

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

$op: The operation that the user is trying to perform.

$account: The user object for the user performing the operation. If omitted, the current user is used.

Return value

An associative array in which the keys are realms, and the values are arrays of grants for those realms.

Related topics

1 call to node_access_grants()
_node_query_node_access_alter in modules/node/node.module
Helper for node access functions.

File

modules/node/node.module, line 3196
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_access_grants($op, $account = NULL) {
  if (!isset($account)) {
    $account = $GLOBALS['user'];
  }

  // Fetch node access grants from other modules.
  $grants = module_invoke_all('node_grants', $account, $op);

  // Allow modules to alter the assigned grants.
  drupal_alter('node_grants', $grants, $account, $op);
  return array_merge(array(
    'all' => array(
      0,
    ),
  ), $grants);
}