Permissions are now always false when permission calculation hasn't been done yet

lack of permission calculation means that child permissions might not have been set correctly, so this might lead to users being able to access things they aren't supposed to.
This commit is contained in:
Dylan K. Taylor 2020-11-28 21:55:26 +00:00
parent 97a4d80854
commit d56cf35385
3 changed files with 4 additions and 8 deletions

View File

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

View File

@ -79,14 +79,7 @@ class PermissibleBase implements Permissible{
return $this->permissions[$name]->getValue();
}
if(($perm = PermissionManager::getInstance()->getPermission($name)) !== null){
$perm = $perm->getDefault();
return $perm === Permission::DEFAULT_TRUE or ($this->isOp() and $perm === Permission::DEFAULT_OP) or (!$this->isOp() and $perm === Permission::DEFAULT_NOT_OP);
}else{
return Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_TRUE or ($this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_OP) or (!$this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_NOT_OP);
}
return false;
}
/**

View File

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