1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_handler_filter_user_permissions.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Filter handler for user roles.
|
10
|
*
|
11
|
* @ingroup views_filter_handlers
|
12
|
*/
|
13
|
class views_handler_filter_user_permissions extends views_handler_filter_many_to_one {
|
14
|
|
15
|
/**
|
16
|
* {@inheritdoc}
|
17
|
*/
|
18
|
public function get_value_options() {
|
19
|
$module_info = system_get_info('module');
|
20
|
|
21
|
// Get a list of all the modules implementing a hook_permission() and sort
|
22
|
// by display name.
|
23
|
$modules = array();
|
24
|
foreach (module_implements('permission') as $module) {
|
25
|
$modules[$module] = $module_info[$module]['name'];
|
26
|
}
|
27
|
asort($modules);
|
28
|
|
29
|
$this->value_options = array();
|
30
|
foreach ($modules as $module => $display_name) {
|
31
|
if ($permissions = module_invoke($module, 'permission')) {
|
32
|
foreach ($permissions as $perm => $perm_item) {
|
33
|
// @todo group by module but views_handler_filter_many_to_one does not support this.
|
34
|
$this->value_options[$perm] = check_plain(strip_tags($perm_item['title']));
|
35
|
}
|
36
|
}
|
37
|
}
|
38
|
}
|
39
|
|
40
|
}
|