Skip to content

Commit 1eab9ba

Browse files
committed
Fix property $aclList accessed before initialization
1 parent 47eb965 commit 1eab9ba

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Ubiquity/security/acl/AclManager.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
class AclManager {
2929

30-
protected static AclList $aclList;
30+
protected static ?AclList $aclList=null;
3131

3232
protected static PermissionsMap $permissionMap;
3333

@@ -40,7 +40,7 @@ public static function start(): void {
4040
self::$aclList = new AclList();
4141
self::$aclList->init();
4242
}
43-
43+
4444
/**
4545
* Start the Acls with AclCacheProvider (for attributes or annotations).
4646
*/
@@ -55,7 +55,7 @@ public static function startWithCacheProvider(): void {
5555
* @return bool
5656
*/
5757
public static function isStarted(): bool {
58-
return self::$aclList !== NULL && (self::$aclList instanceof AclList);
58+
return isset(self::$aclList) && (self::$aclList instanceof AclList);
5959
}
6060

6161
/**
@@ -181,7 +181,7 @@ public static function addAndAllow(string $role, ?string $resource = '*', ?strin
181181
public static function isAllowed(string $role, ?string $resource = '*', ?string $permission = 'ALL'): bool {
182182
return self::$aclList->isAllowed($role, $resource ?? '*', $permission ?? 'ALL');
183183
}
184-
184+
185185
public static function isAllowedRoute(string $role,string $routeName){
186186
$routeInfo=Router::getRouteInfoByName($routeName);
187187
if (!isset ( $routeDetails ['controller'] )) {
@@ -384,4 +384,3 @@ public static function initializeDAOProvider(array &$config, string $dbOffset='d
384384
return AclDAOProvider::initializeProvider($config,$dbOffset,$classes);
385385
}
386386
}
387-

0 commit comments

Comments
 (0)