function module_grants_db_rewrite_sql in Module Grants 6.3
Same name and namespace in other branches
- 6.4 module_grants.module \module_grants_db_rewrite_sql()
Implementation of hook_db_rewrite_sql().
This module defines module_grants_node_access() (above) as a replacement for node_access(), which is used only for single node views. Node access in listings is processed with node_db_rewrite_sql(), which needs to have the same treatment. This function is similar to node_db_rewrite_sql() in node.module but ANDs rather than ORs grants together on a per module base to create a more natural behaviour. Supplied by mcarbone, see [#601064].
File
- ./
module_grants.module, line 356 - Module to apply access grants to pre-published content just as they are to published content and to make multiple content access modules work together in the expected way.
Code
function module_grants_db_rewrite_sql($query, $primary_table, $primary_field) {
if ($primary_field == 'nid' && !variable_get('module_grants_OR_modules', FALSE)) {
if (!node_access_view_all_nodes()) {
//$return['where'] = _module_grants_node_access_where_sql();
//Rather than the above line [#753586] suggests the following
$return['where'] = _module_grants_node_access_where_sql('view', $primary_table);
return $return;
}
}
}