The only moment where the node access table could be empty is when node_access_write_grants() (or node_access_rebuild()) deletes the content of the table before to repopulate it.
In the case of node_access_write_grants()
, the table could become empty only if the table contained the access data for a node; in the case of node_access_rebuild()
, the table becomes empty in any cases.
Sometimes the all
entry can vanish, as node_access_acquire_grants() adds that entry only if no modules returned access records for the node passed as argument to the function, and node_access_rebuild()
adds that entry if no module returned access records.
To notice also that, in the case the $realm
passed to node_access_write_grants()
doesn't match with the value contained in $grant['realm']
(for all the grants passed to the function), then node_access_write_grants()
will delete the access records for the node passed as argument, but it will not save any access records.
// Only perform work when node_access modules are active.
if (count(module_implements('node_grants'))) {
foreach ($grants as $grant) {
if ($realm && $realm != $grant['realm']) {
continue;
}
// Only write grants; denies are implicit.
if ($grant['grant_view'] || $grant['grant_update'] || $grant['grant_delete']) {
db_query("INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) VALUES (%d, '%s', %d, %d, %d, %d)", $node->nid, $grant['realm'], $grant['gid'], $grant['grant_view'], $grant['grant_update'], $grant['grant_delete']);
}
}
}
The same can happen if a module calls node_access_write_grants()
using the default value for $delete
, and there aren't modules implementing hook_node_grants()
.
In these cases, the node access table can become empty if the table contained data only for the node passed as argument to node_access_write_grants()
.