[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/views/plugins/ -> views_plugin_access_perm.inc (source)

   1  <?php
   2  // $Id: views_plugin_access_perm.inc,v 1.3.4.1 2010/03/10 21:03:25 merlinofchaos Exp $
   3  
   4  /**
   5   * Access plugin that provides permission-based access control.
   6   */
   7  class views_plugin_access_perm extends views_plugin_access {
   8    function access($account) {
   9      return views_check_perm($this->options['perm'], $account);
  10    }
  11  
  12    function get_access_callback() {
  13      return array('views_check_perm', array($this->options['perm']));
  14    }
  15  
  16    function summary_title() {
  17      return t($this->options['perm']);
  18    }
  19  
  20    function option_defaults(&$options) {
  21      $options['perm'] = 'access content';
  22    }
  23  
  24    function options_form(&$form, &$form_state) {
  25      $perms = array();
  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);
  30        }
  31      }
  32      $form['perm'] = array(
  33        '#type' => 'select',
  34        '#options' => $perms,
  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.'),
  38      );
  39    }
  40  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7