You are here

function devel_node_access_node_access_explain in Devel 7

Same name and namespace in other branches
  1. 5 devel_node_access.module \devel_node_access_node_access_explain()
  2. 6 devel_node_access.module \devel_node_access_node_access_explain()

Implements hook_node_access_explain().

File

./devel_node_access.module, line 1358
Functions for debugging node access permissions.

Code

function devel_node_access_node_access_explain($row) {
  if ($row->gid == 0 && $row->realm == 'all') {
    foreach (array(
      'view',
      'update',
      'delete',
    ) as $op) {
      $gop = 'grant_' . $op;
      if (!empty($row->{$gop})) {
        $ops[] = $op;
      }
    }
    if (empty($ops)) {
      return '(No access granted to ' . ($row->nid == 0 ? 'any nodes.)' : 'this node.)');
    }
    else {
      return 'All users may ' . implode('/', $ops) . ($row->nid == 0 ? ' all nodes.' : ' this node.');
    }
  }
}