From 45f45065d22b1d95411e71da7f59498f972a3594 Mon Sep 17 00:00:00 2001 From: An Xuan Hoang Date: Mon, 11 May 2020 09:39:33 +0700 Subject: [PATCH 1/3] Fixed incorrectly inserting role to YAML --- src/CortexPE/Hierarchy/data/role/IndexedRoleDS.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CortexPE/Hierarchy/data/role/IndexedRoleDS.php b/src/CortexPE/Hierarchy/data/role/IndexedRoleDS.php index 75f0bd0..304af95 100644 --- a/src/CortexPE/Hierarchy/data/role/IndexedRoleDS.php +++ b/src/CortexPE/Hierarchy/data/role/IndexedRoleDS.php @@ -114,12 +114,12 @@ public function removeRolePermission(Role $role, $permission): void { } public function createRoleOnStorage(string $name, int $id, int $position): void { - array_splice($this->roles, $position, 0, [ + array_splice($this->roles, $position, 0, [[ "ID" => $id, "Name" => $name, "isDefault" => false, "Permissions" => [] - ]); + ]]); $this->flush(); } From a9b55978c570524d0c9dfb6b67d417e5a23882d2 Mon Sep 17 00:00:00 2001 From: An Xuan Hoang Date: Mon, 11 May 2020 10:18:49 +0700 Subject: [PATCH 2/3] Fixed incorrect input for the /info Form processing --- src/CortexPE/Hierarchy/command/subcommand/InfoCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CortexPE/Hierarchy/command/subcommand/InfoCommand.php b/src/CortexPE/Hierarchy/command/subcommand/InfoCommand.php index 4dbcc4c..daad3d5 100644 --- a/src/CortexPE/Hierarchy/command/subcommand/InfoCommand.php +++ b/src/CortexPE/Hierarchy/command/subcommand/InfoCommand.php @@ -78,7 +78,7 @@ function(Player $player, CustomFormResponse $response): void { $this->setCurrentSender($player); $this->onRun($player, $this->getName(), [ "targetType" => InfoTargetEnumArgument::TARGET_MEMBER, - "targetMember" => $this->memberFactory->getMember($response->getString("member")) + "targetMember" => [$this->memberFactory->getMember($response->getString("member"))] ]); } ], @@ -97,7 +97,7 @@ function(Player $player, CustomFormResponse $response) use ($roles, $roles_i): v $this->setCurrentSender($player); $this->onRun($player, $this->getName(), [ "targetType" => InfoTargetEnumArgument::TARGET_ROLE, - "targetRole" => $this->roleManager->getRole($roles_i[$response->getInt("roles")]) + "targetRole" => [$this->roleManager->getRole($roles_i[$response->getInt("roles")])] ]); } ], From 07cb7c29a238cdd5bf387a16c2e8fa622cfba568 Mon Sep 17 00:00:00 2001 From: An Xuan Hoang Date: Tue, 12 May 2020 10:50:12 +0700 Subject: [PATCH 3/3] Fixed permissions not being removed after takeRole --- src/CortexPE/Hierarchy/member/Member.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CortexPE/Hierarchy/member/Member.php b/src/CortexPE/Hierarchy/member/Member.php index 41ba6f0..8afafa9 100644 --- a/src/CortexPE/Hierarchy/member/Member.php +++ b/src/CortexPE/Hierarchy/member/Member.php @@ -57,6 +57,7 @@ public function getAttachment(): ?PermissionAttachment { public function recalculatePermissions(): void { parent::recalculatePermissions(); + $this->attachment->clearPermissions(); $this->attachment->setPermissions($this->permissions); }