-
Notifications
You must be signed in to change notification settings - Fork 4
/
rbac.php
84 lines (77 loc) · 2.72 KB
/
rbac.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
include_once 'core/init.php';
//$general->logged_out_protect();
/*
$role_descriptions = array(
'President',
'Marketing Manager',
'Web Developer'
);
$rbac->Roles->addPath('/president/marketing_manager/web_developer', $role_descriptions);
$role_descriptions = array(
'President',
'Marketing Manager',
'E-commerce Specialist'
);
$rbac->Roles->addPath('/president/marketing_manager/e_commerce_specialist', $role_descriptions);
$role_descriptions = array(
'President',
'Marketing Manager',
'Graphic Designer'
);
$rbac->Roles->addPath('/president/marketing_manager/graphic_designer',$role_descriptions);
$role_descriptions = array(
'President',
'Marketing Manager',
'Marketing Assistant'
);
$rbac->Roles->addPath('/president/marketing_manager/marketing_assistant',$role_descriptions);
$role_descriptions = array(
'President',
'Operations Manager',
'Musikey Clerk'
);
$rbac->Roles->addPath('/president/operations_manager/musikey_clerk',$role_descriptions);
//*/
//$rbac->Roles->remove(36);
//$rbac->Roles->remove(37);
/*
$perm_descriptions = array(
'Management',
'E-Commerce'
);
$rbac->Permissions->addPath('/management/e_commerce', $perm_descriptions);
$perm_descriptions = array(
'E-Commerce'
);
$rbac->Permissions->addPath('/e_commerce', $perm_descriptions);
$perm_descriptions = array(
'MusiKey'
);
$rbac->Permissions->addPath('/musikey', $perm_descriptions);
//*/
//$rbac->Permissions->remove(2);
//$rbac->Permissions->remove(3);
//$rbac->Permissions->assign('president', 'management'); // President - Management
//$rbac->Permissions->assign('president', 'e_commerce'); // President - E-Commerce
//$rbac->Permissions->assign('president', 'musikey'); // President - MusiKey
//$rbac->Permissions->assign('marketing_manager', 'management'); // Marketing Manager - Management
//$rbac->Permissions->assign('marketing_manager', 'e_commerce'); // Marketing Manager - E-Commerce
//$rbac->Permissions->assign('marketing_manager', 'musikey'); // Marketing Manager - MusiKey
//$rbac->Permissions->assign('operations_manager', 'management'); // Operations Manager - Management
//$rbac->Permissions->assign('operations_manager', 'musikey'); // Operations Manager - MusiKey
//$rbac->Permissions->assign('musikey_clerk', 'musikey'); // Musikey Clerk - MusiKey
//$rbac->Permissions->assign('web_developer', 'e_commerce'); //Web Developer - E-Commerce'
//$rbac->Permissions->assign('e_commerce_specialist', 'e_commerce'); //E-commerce Specialist - E-Commerce
//$oldrole = '';
$newrole = 'marketing_manager';
$user_id = '842';
//$rbac->Users->unassign($oldrole, $user_id); //Me Dummy
echo $newrole . ' ' . $user_id;
$rbac->Users->assign($newrole, $user_id); //Me Dummy
if ($rbac->check('management', $user_id)) {
echo 'true';
} else {
echo 'false';
}
?>