[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * Access plugin that provides permission-based access control.
   5   */
   6  class views_plugin_access_perm extends views_plugin_access {
   7    function access($account) {
   8      return views_check_perm($this->options['perm'], $account);
   9    }
  10  
  11    function get_access_callback() {
  12      return array('views_check_perm', array($this->options['perm']));
  13    }
  14  
  15    function summary_title() {
  16      return t($this->options['perm']);
  17    }
  18  
  19    function option_defaults(&$options) {
  20      $options['perm'] = 'access content';
  21    }
  22  
  23    function options_form(&$form, &$form_state) {
  24      $perms = array();
  25      // Get list of permissions
  26      foreach (module_list(FALSE, FALSE, TRUE) as $module) {
  27        if ($permissions = module_invoke($module, 'perm')) {
  28          $perms[$module] = drupal_map_assoc($permissions);
  29        }
  30      }
  31      $form['perm'] = array(
  32        '#type' => 'select',
  33        '#options' => $perms,
  34        '#title' => t('Permission'),
  35        '#default_value' => $this->options['perm'],
  36        '#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.'),
  37      );
  38    }
  39  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7