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