1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_plugin_access.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* @defgroup views_access_plugins Views access plugins
|
10
|
* @{
|
11
|
* @todo.
|
12
|
*
|
13
|
* @see hook_views_plugins()
|
14
|
*/
|
15
|
|
16
|
/**
|
17
|
* The base plugin to handle access control.
|
18
|
*/
|
19
|
class views_plugin_access extends views_plugin {
|
20
|
|
21
|
/**
|
22
|
* Initialize the plugin.
|
23
|
*
|
24
|
* @param view $view
|
25
|
* The view object.
|
26
|
* @param object $display
|
27
|
* The display handler.
|
28
|
*/
|
29
|
public function init(&$view, &$display) {
|
30
|
$this->view = &$view;
|
31
|
$this->display = &$display;
|
32
|
|
33
|
if (is_object($display->handler)) {
|
34
|
$options = $display->handler->get_option('access');
|
35
|
// Overlay incoming options on top of defaults.
|
36
|
$this->unpack_options($this->options, $options);
|
37
|
}
|
38
|
}
|
39
|
|
40
|
/**
|
41
|
* Retrieve the options when this is a new access control plugin.
|
42
|
*/
|
43
|
public function option_definition() {
|
44
|
return array();
|
45
|
}
|
46
|
|
47
|
/**
|
48
|
* Provide the default form for setting options.
|
49
|
*/
|
50
|
public function options_form(&$form, &$form_state) {
|
51
|
}
|
52
|
|
53
|
/**
|
54
|
* Provide the default form form for validating options.
|
55
|
*/
|
56
|
public function options_validate(&$form, &$form_state) {
|
57
|
}
|
58
|
|
59
|
/**
|
60
|
* Provide the default form form for submitting options.
|
61
|
*/
|
62
|
public function options_submit(&$form, &$form_state) {
|
63
|
}
|
64
|
|
65
|
/**
|
66
|
* Return a string to display as the clickable title for the access control.
|
67
|
*/
|
68
|
public function summary_title() {
|
69
|
return t('Unknown');
|
70
|
}
|
71
|
|
72
|
/**
|
73
|
* Determine if the current user has access or not.
|
74
|
*/
|
75
|
public function access($account) {
|
76
|
// Default to no access control.
|
77
|
return TRUE;
|
78
|
}
|
79
|
|
80
|
/**
|
81
|
* Determine the access callback and arguments.
|
82
|
*
|
83
|
* This information will be embedded in the menu in order to reduce
|
84
|
* performance hits during menu item access testing, which happens
|
85
|
* a lot.
|
86
|
*
|
87
|
* @return array
|
88
|
* The first item should be the function to call, and the second item should
|
89
|
* be an array of arguments. The first item may also be TRUE (bool only)
|
90
|
* which will indicate no access control.
|
91
|
*/
|
92
|
public function get_access_callback() {
|
93
|
// Default to no access control.
|
94
|
return TRUE;
|
95
|
}
|
96
|
|
97
|
}
|
98
|
|
99
|
/**
|
100
|
* @}
|
101
|
*/
|