Removing translation directories
[project/views.git] / modules / node / views_handler_filter_node_access.inc
CommitLineData
29745c93 1<?php
29745c93
EM
2/**
3 * Filter by node_access records.
4 */
5class views_handler_filter_node_access extends views_handler_filter {
6 function admin_summary() { }
7 function operator_form() { }
8 function can_expose() {
9 return FALSE;
10 }
11
12 /**
13 * See _node_access_where_sql() for a non-views query based implementation.
14 */
15 function query() {
16 if (!user_access('administer nodes')) {
17 $table = $this->ensure_my_table();
18 $grants = array();
868b22d3 19 foreach (node_access_grants('view') as $realm => $gids) {
29745c93
EM
20 foreach ($gids as $gid) {
21 $grants[] = "($table.gid = $gid AND $table.realm = '$realm')";
22 }
23 }
24 $grants_sql = '';
25 if (count($grants)) {
26 $grants_sql = implode(' OR ', $grants);
27 }
28 $this->query->add_where('AND', $grants_sql);
29 $this->query->add_where('AND', "$table.grant_view >= 1");
30 }
31 }
32}