Automatic permission calculation on PermissibleBase construction

thanks to the PermissibleInternal/PermissibleBase architectural change, there's no longer any concern regarding cyclic refs.
This commit is contained in:
Dylan K. Taylor 2021-06-26 22:15:22 +01:00
parent 02fab77e55
commit ede4d58394
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 1 additions and 6 deletions

View File

@ -1124,7 +1124,6 @@ class Server{
//TODO: move console parts to a separate component //TODO: move console parts to a separate component
$consoleSender = new ConsoleCommandSender($this, $this->language); $consoleSender = new ConsoleCommandSender($this, $this->language);
$consoleSender->recalculatePermissions();
$this->subscribeToBroadcastChannel(self::BROADCAST_CHANNEL_ADMINISTRATIVE, $consoleSender); $this->subscribeToBroadcastChannel(self::BROADCAST_CHANNEL_ADMINISTRATIVE, $consoleSender);
$this->subscribeToBroadcastChannel(self::BROADCAST_CHANNEL_USERS, $consoleSender); $this->subscribeToBroadcastChannel(self::BROADCAST_CHANNEL_USERS, $consoleSender);

View File

@ -64,10 +64,8 @@ class PermissibleInternal implements Permissible{
public function __construct(array $basePermissions){ public function __construct(array $basePermissions){
$this->permissionRecalculationCallbacks = new ObjectSet(); $this->permissionRecalculationCallbacks = new ObjectSet();
//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...
$this->rootPermissions = $basePermissions; $this->rootPermissions = $basePermissions;
//TODO: permissions need to be recalculated here, or inherited permissions won't work $this->recalculatePermissions();
} }
public function setBasePermission($name, bool $grant) : void{ public function setBasePermission($name, bool $grant) : void{

View File

@ -305,8 +305,6 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
return; return;
} }
$this->perm->recalculatePermissions();
$this->server->getLogger()->info($this->getServer()->getLanguage()->translateString("pocketmine.player.logIn", [ $this->server->getLogger()->info($this->getServer()->getLanguage()->translateString("pocketmine.player.logIn", [
TextFormat::AQUA . $this->username . TextFormat::WHITE, TextFormat::AQUA . $this->username . TextFormat::WHITE,
$session->getIp(), $session->getIp(),