source: sipes/modules_contrib/module_grants/module_grants.api.php @ de78188

stableversion-3.0
Last change on this file since de78188 was 177a560, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el directorio de modulos contribuidos de drupal

  • Propiedad mode establecida a 100644
File size: 1.3 KB
Línea 
1<?php
2
3/**
4 * @file
5 *  Hooks provided by the Module Grants module.
6 */
7
8/**
9 * @addtogroup hooks
10 * @{
11 */
12
13/**
14 * Called from module_grants_node_revision_access() this hook allows
15 * contributed modules to either deny access to the supplied node or to
16 * state which node operation the user must be allowed to execute to access
17 * the node via the supplied revision operation.
18 *
19 * If implemented this function should return either FALSE (meaning deny
20 * access to the node for this revision_op) or a required node operation (ie.
21 * 'view', 'update', 'delete'). This node operation is passed to
22 * module_grants_node_access(), which returns a boolean indicating whether
23 * access is granted or not.
24 * The Revisioning module takes advantage of this hook to combine its
25 * revision-related user permissions with proper access control, as provided by
26 * Module Grants.
27 *
28 * @param $revision_op
29 * @param $node
30 * @return
31 *   either FALSE or the node operation required to access the node, i.e.
32 *   'view', 'update' or 'delete'
33 */
34function hook_user_node_access($revision_op, $node) {
35  switch ($revision_op) {
36    case 'view revision list':
37      return user_access('view revisions') ? 'view' : FALSE;
38
39    case 'edit revisions':
40      return user_access('edit revisions') ? 'update' : FALSE;
41  }
42  return 'view';
43}
44
45/**
46 * @} End of "addtogroup hooks".
47 */
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.