mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
PermissibleBase: do not assign any permissions by default
there is no longer such a thing as a permission granted to 'everyone', since we're no longer limited to true/false/op/notop, and regular players are now assigned the pocketmine.group.user permission. It's possible we might want to add more restricted groups than 'user' in the future, in which case it would be behaviour-BC-breaking to change the default assigned permissions when creating a new PermissibleBase. Therefore, it's better to not assign any permissions at all and let the caller decide. In addition, this solves the problem of implied permission subscriptions and leak on PermissibleBase construction - if base permissions are provided, it should be expected that the permissible will subscribe to those permissions.
This commit is contained in:
parent
05c52fef46
commit
807474b3fb
@ -35,9 +35,7 @@ class PermissibleBase implements Permissible{
|
||||
* @var bool[]
|
||||
* @phpstan-var array<string, bool>
|
||||
*/
|
||||
private $rootPermissions = [
|
||||
DefaultPermissions::ROOT_USER => true
|
||||
];
|
||||
private $rootPermissions;
|
||||
|
||||
/** @var PermissionAttachment[] */
|
||||
private $attachments = [];
|
||||
@ -60,9 +58,7 @@ class PermissibleBase implements Permissible{
|
||||
|
||||
//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...
|
||||
foreach($basePermissions as $permission => $isGranted){
|
||||
$this->rootPermissions[$permission] = $isGranted;
|
||||
}
|
||||
$this->rootPermissions = $basePermissions;
|
||||
//TODO: permissions need to be recalculated here, or inherited permissions won't work
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user