source: sipes/modules_contrib/views/plugins/views_plugin_access_perm.inc @ a8b1f3f

stableversion-3.0
Last change on this file since a8b1f3f was 59029b2, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se actualizo la version del modulo views

  • Propiedad mode establecida a 100644
File size: 1.2 KB
Línea 
1<?php
2
3/**
4 * Access plugin that provides permission-based access control.
5 */
6class 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
20  function option_definition() {
21    $options = parent::option_definition();
22    $options['perm'] = array('default' => 'access content');
23
24    return $options;
25  }
26
27  function options_form(&$form, &$form_state) {
28    $perms = array();
29    // Get list of permissions
30    foreach (module_list(FALSE, FALSE, TRUE) as $module) {
31      if ($permissions = module_invoke($module, 'perm')) {
32        $perms[$module] = drupal_map_assoc($permissions);
33      }
34    }
35    $form['perm'] = array(
36      '#type' => 'select',
37      '#options' => $perms,
38      '#title' => t('Permission'),
39      '#default_value' => $this->options['perm'],
40      '#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.'),
41    );
42  }
43}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.