node_access_grants

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 node_access_grants($op, $account = NULL)

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.

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.

Übergabeparameter

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

Rückgabewert

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

Verwandte Themen

▾ 5 functions call node_access_grants()

hook_query_TAG_alter in modules/system/system.api.php
Perform alterations to a structured query for a given tag.
node_access in modules/node/node.module
Determine whether the current user may perform the given operation on the specified node.
node_access_view_all_nodes in modules/node/node.module
Determine whether the user has a global viewing grant for all nodes.
node_query_node_access_alter in modules/node/node.module
Implementation of hook_query_TAG_alter().
_node_access_where_sql in modules/node/node.module
Generate an SQL where clause for use in fetching a node listing.

Code

modules/node/node.module, line 2539

<?php
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);
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen