1 views_handler_filter_node_access.inc | views_handler_filter_node_access::query() |
See _node_access_where_sql() for a non-views query based implementation.
Overrides views_handler_filter::query
File
- core/
modules/ node/ views/ views_handler_filter_node_access.inc, line 22 - Definition of views_handler_filter_node_access.
Class
- views_handler_filter_node_access
- Filter by node_access records.
Code
function query() {
if (!user_access('administer nodes') && module_implements('node_grants')) {
$table = $this->ensure_my_table();
$grants = db_or();
foreach (node_access_grants('view') as $realm => $gids) {
foreach ($gids as $gid) {
$grants->condition(db_and()
->condition($table . '.gid', $gid)
->condition($table . '.realm', $realm)
);
}
}
$this->query->add_where('AND', $grants);
$this->query->add_where('AND', $table . '.grant_view', 1, '>=');
}
}