From d3f8c993b16e97829272ea2f21f4a4d2497cf4c0 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Mon, 5 Feb 2024 19:26:23 +0100 Subject: [PATCH] Fix bad permission checks in Web UI Fix attempts to check for permissions that don't exist in the Web UI that has gone unnoticed because the check still succeeds when the account has the cluster admin permission. --- CHANGELOG.md | 1 + packages/web_ui/src/components/HostViewPage.tsx | 2 +- packages/web_ui/src/components/ModPackViewPage.tsx | 2 +- packages/web_ui/src/components/ModsPage.tsx | 4 ++-- packages/web_ui/src/pages.tsx | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a6b7b5..65cbac3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Fixed instance screen in Web UI not updating when an instance was reassigned. - Fixed an error thrown in the rendering of one page in the Web UI causing all pages to become inaccessible. - Fixed Web UI not showing instance saves when the permission to list and subscribe the saves is granted but the user is not a cluster admin. +- Similarly fixed Web UI not showing the mod pack create, delete, list and host revoke token actions if the user is not a cluster admin. ## Version 2.0.0-alpha.16 diff --git a/packages/web_ui/src/components/HostViewPage.tsx b/packages/web_ui/src/components/HostViewPage.tsx index fc71311d..f70d9e2c 100644 --- a/packages/web_ui/src/components/HostViewPage.tsx +++ b/packages/web_ui/src/components/HostViewPage.tsx @@ -48,7 +48,7 @@ export default function HostViewPage() { let hostButtons = { - account.hasPermission("core.host.revoke_access") + account.hasPermission("core.host.revoke_token") && - {account.hasPermission("core.mod-pack.delete") && - {account.hasPermission("core.mod-pack.create") && } - {account.hasPermission("core.mod-pack.create") && } + {account.hasPermission("core.mod_pack.create") && } + {account.hasPermission("core.mod_pack.create") && } } /> account.hasAnyPermission("core.mod.list", "core.mod-pack.list"), + permission: (account: UserAccount) => account.hasAnyPermission("core.mod.list", "core.mod_pack.list"), content: , }, {