mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 20:14:31 +00:00
PermissibleBase: allow injecting more dynamic base permissions
This commit is contained in:
@@ -51,13 +51,17 @@ class PermissibleBase implements Permissible{
|
||||
*/
|
||||
private $permissionRecalculationCallbacks;
|
||||
|
||||
public function __construct(bool $isOp){
|
||||
/**
|
||||
* @param bool[] $basePermissions
|
||||
* @phpstan-param array<string, bool> $basePermissions
|
||||
*/
|
||||
public function __construct(array $basePermissions){
|
||||
$this->permissionRecalculationCallbacks = new Set();
|
||||
|
||||
//TODO: we can't setBasePermission here directly due to bad architecture that causes recalculatePermissions to explode
|
||||
//so, this hack has to be done here to prevent permission recalculations until it's fixed...
|
||||
if($isOp){
|
||||
$this->rootPermissions[DefaultPermissions::ROOT_OPERATOR] = true;
|
||||
foreach($basePermissions as $permission => $isGranted){
|
||||
$this->rootPermissions[$permission] = $isGranted;
|
||||
}
|
||||
//TODO: permissions need to be recalculated here, or inherited permissions won't work
|
||||
}
|
||||
|
Reference in New Issue
Block a user