-
Notifications
You must be signed in to change notification settings - Fork 12
/
acl.spices.php
executable file
·80 lines (65 loc) · 1.98 KB
/
acl.spices.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
<?php
namespace PhpBURN\Spices\ACL;
\PhpBURN::loadSpice('acl',array('1.0'));
############################################
# Create Settings
############################################
/**
* ACL Spice Settings
*/
$aclSettings = array(
/**
* This defines the default visibility based on method/action type
* public, protected and private
*/
'defaultVisibile' => array(
'public'
// 'protected',
// 'private'
),
/**
* This defines the default permission when @acldefault is not set for the
* Controller or Action.
*
* Note you can override this anytime ( in @acldefault at Controller or Action ).
*/
'defaultPermission' => 'allow',
/**
* This defines the default type of each action
* read, write, exclude and unknown ( recommended )
*
* This typing only have logistic function it does not affect the code
*/
'defaultType' => 'unknown',
'authInfo' => array(
'allowedMethods' => &$_SESSION[PHPBURN_SESSIONNAME]['userInfo']['allowedMethods']
)
);
############################################
# Define ACL configuration
############################################
PhpBURN_ACL::setConfig($aclSettings);
PhpBURN_ACL_Control::generateRules();
############################################
# callBack functions
############################################
$callBack = array(
'granted' => function() {
return true;
},
'denied' => function() {
die("Your access to this area has been denied. You've been a bad bad dog!");
}
);
PhpBURN_ACL::setCallBack($callBack);
############################################
# Add Controller onCallActionBefore to be
# executed before each controller call
############################################
\PhpBURN_ControllerConfig::addOnCallActionBefore(
'phpburn_spice_acl',
function($controllerName, $action, $parms) {
PhpBURN_ACL::checkPermissions($controllerName, $action, $parms);
}
);
?>