node_access_grants

Definition

node_access_grants($op, $uid = NULL)
modules/node.module, line 2488

Description

Fetch 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.

Parameters

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

$uid The user ID 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

Namesort iconDescription
Node access rightsThe node access system determines who can do what to which nodes.

Code

<?php
function node_access_grants($op, $uid = NULL) {
  global $user;

  if (isset($uid)) {
    $user_object = user_load(array('uid' => $uid));
  }
  else {
    $user_object = $user;
  }

  return array_merge(array('all' => array(0)), module_invoke_all('node_grants', $user_object, $op));
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.