-
Notifications
You must be signed in to change notification settings - Fork 1
/
MasqueradePlugin.php
48 lines (39 loc) · 1.19 KB
/
MasqueradePlugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
if (!defined('MASQUERADE_DIR')) {
define('MASQUERADE_DIR', dirname(__FILE__));
}
class MasqueradePlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array(
'define_acl',
);
protected $_filters = array('admin_navigation_main', 'public_navigation_admin_bar');
public function hookDefineAcl($args)
{
// Restrict access to super and admin users.
$args['acl']->addResource('Masquerade_Index');
}
public function filterAdminNavigationMain($nav) {
$nav[] = array(
'label' => __('Masquerade'),
'uri' => url('masquerade'),
'resource' => 'Masquerade_Index',
'privilege' => 'index'
);
return $nav;
}
public function filterPublicNavigationAdminBar($navLinks)
{
if (is_allowed('Masquerade_Index', 'edit')) {
$editLinks = array(
'redirect' => array(
'label'=>'Masquerade',
'uri' => admin_url('masquerade'),
'target' => '_blank',
),
);
$navLinks = array_merge($editLinks, $navLinks);
}
return $navLinks;
}
}