2 // $Id: views_plugin_access_perm.inc,v 1.3 2009/01/07 23:31:13 merlinofchaos Exp $
5 * Access plugin that provides permission-based access control.
7 class views_plugin_access_perm extends views_plugin_access {
8 function access($account) {
9 return user_access($this->options['perm'], $account);
12 function get_access_callback() {
13 return array('user_access', array($this->options['perm']));
16 function summary_title() {
17 return t($this->options['perm']);
20 function option_defaults(&$options) {
21 $options['perm'] = 'access content';
24 function options_form(&$form, &$form_state) {
26 // Get list of permissions
27 foreach (module_list(FALSE, FALSE, TRUE) as $module) {
28 if ($permissions = module_invoke($module, 'perm')) {
29 $perms[$module] = drupal_map_assoc($permissions);
32 $form['perm'] = array(
35 '#title' => t('Permission'),
36 '#default_value' => $this->options['perm'],
37 '#description' => t('Only users with the selected permission flag will be able to access this display. Note that users with "access all views" can see any view, regardless of other permissions.'),