27
27
*/
28
28
class AclManager {
29
29
30
- protected static AclList $ aclList ;
30
+ protected static ? AclList $ aclList= null ;
31
31
32
32
protected static PermissionsMap $ permissionMap ;
33
33
@@ -40,7 +40,7 @@ public static function start(): void {
40
40
self ::$ aclList = new AclList ();
41
41
self ::$ aclList ->init ();
42
42
}
43
-
43
+
44
44
/**
45
45
* Start the Acls with AclCacheProvider (for attributes or annotations).
46
46
*/
@@ -55,7 +55,7 @@ public static function startWithCacheProvider(): void {
55
55
* @return bool
56
56
*/
57
57
public static function isStarted (): bool {
58
- return self ::$ aclList !== NULL && (self ::$ aclList instanceof AclList);
58
+ return isset ( self ::$ aclList) && (self ::$ aclList instanceof AclList);
59
59
}
60
60
61
61
/**
@@ -181,7 +181,7 @@ public static function addAndAllow(string $role, ?string $resource = '*', ?strin
181
181
public static function isAllowed (string $ role , ?string $ resource = '* ' , ?string $ permission = 'ALL ' ): bool {
182
182
return self ::$ aclList ->isAllowed ($ role , $ resource ?? '* ' , $ permission ?? 'ALL ' );
183
183
}
184
-
184
+
185
185
public static function isAllowedRoute (string $ role ,string $ routeName ){
186
186
$ routeInfo =Router::getRouteInfoByName ($ routeName );
187
187
if (!isset ( $ routeDetails ['controller ' ] )) {
@@ -384,4 +384,3 @@ public static function initializeDAOProvider(array &$config, string $dbOffset='d
384
384
return AclDAOProvider::initializeProvider ($ config ,$ dbOffset ,$ classes );
385
385
}
386
386
}
387
-
0 commit comments