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