function devel_node_access_node_access_explain

Same name in other branches
  1. 6.x-1.x devel_node_access.module \devel_node_access_node_access_explain()

Implements hook_node_access_explain().

File

./devel_node_access.module, line 1358

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.');
        }
    }
}