|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* RBAC implementation for HiPanel |
|
5
|
|
|
* |
|
6
|
|
|
* @link https://github.com/hiqdev/hipanel-rbac |
|
7
|
|
|
* @package hipanel-rbac |
|
8
|
|
|
* @license BSD-3-Clause |
|
9
|
|
|
* @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/) |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace hipanel\rbac; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Initer for AuthManager. |
|
16
|
|
|
* |
|
17
|
|
|
* @author Andrii Vasyliev <[email protected]> |
|
18
|
|
|
*/ |
|
19
|
|
|
class Initer |
|
20
|
|
|
{ |
|
21
|
1 |
|
public static function init(AuthManager $auth) |
|
22
|
|
|
{ |
|
23
|
1 |
|
$auth->setRole('client'); |
|
24
|
1 |
|
$auth->setRole('supportRole'); |
|
25
|
1 |
|
$auth->setRole('adminRole'); |
|
26
|
1 |
|
$auth->setRole('manager'); |
|
27
|
1 |
|
$auth->setRole('reseller'); |
|
28
|
1 |
|
$auth->setRole('owner'); |
|
29
|
1 |
|
$auth->setRole('freezer'); |
|
30
|
|
|
|
|
31
|
1 |
|
$auth->setPermission('deposit'); |
|
32
|
1 |
|
$auth->setPermission('support'); |
|
33
|
1 |
|
$auth->setPermission('manage'); |
|
34
|
1 |
|
$auth->setPermission('admin'); |
|
35
|
1 |
|
$auth->setPermission('resell'); |
|
36
|
1 |
|
$auth->setPermission('own'); |
|
37
|
1 |
|
$auth->setPermission('root'); |
|
38
|
1 |
|
$auth->setPermission('freeze'); |
|
39
|
1 |
|
$auth->setPermission('unfreeze'); |
|
40
|
|
|
|
|
41
|
1 |
|
$auth->setChild('client', 'deposit'); |
|
42
|
|
|
|
|
43
|
1 |
|
$auth->setChild('supportRole', 'support'); |
|
44
|
|
|
|
|
45
|
1 |
|
$auth->setChild('adminRole', 'admin'); |
|
46
|
1 |
|
$auth->setChild('adminRole', 'support'); |
|
47
|
|
|
|
|
48
|
1 |
|
$auth->setChild('manager', 'supportRole'); |
|
49
|
1 |
|
$auth->setChild('manager', 'manage'); |
|
50
|
|
|
|
|
51
|
1 |
|
$auth->setChild('reseller', 'manager'); |
|
52
|
1 |
|
$auth->setChild('reseller', 'resell'); |
|
53
|
|
|
|
|
54
|
1 |
|
$auth->setChild('owner', 'reseller'); |
|
55
|
1 |
|
$auth->setChild('owner', 'own'); |
|
56
|
|
|
|
|
57
|
1 |
|
$auth->setChild('freezer', 'freeze'); |
|
58
|
1 |
|
$auth->setChild('freezer', 'unfreeze'); |
|
59
|
1 |
|
} |
|
60
|
|
|
|
|
61
|
1 |
|
public static function reinit(AuthManager $auth) |
|
62
|
|
|
{ |
|
63
|
1 |
|
$auth->removeAll(); |
|
64
|
1 |
|
static::init($auth); |
|
65
|
1 |
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|