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.
This commit is contained in:
Hornwitser committed 2024-02-06 22:43:04 +01:00
1 parent 535e43b527
commit d3f8c993b1
5 files changed
+6 -5

No files matched your search

+1
View File
@@ -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
@@ -48,7 +48,7 @@ export default function HostViewPage() {
let hostButtons = <Space>
{
account.hasPermission("core.host.revoke_access")
account.hasPermission("core.host.revoke_token")
&& <Popconfirm
title={`Revoke tokens of ${host.name}?`}
placement="bottomRight"
@@ -801,7 +801,7 @@ export default function ModPackViewPage() {
title={modPack.name}
extra={<Space>
<ExportButton modPack={modifiedModPack}/>
{account.hasPermission("core.mod-pack.delete") && <Popconfirm
{account.hasPermission("core.mod_pack.delete") && <Popconfirm
title="Delete mod pack and all of its settings?"
placement="bottomRight"
okText="Delete"
+2 -2
View File
@@ -186,8 +186,8 @@ export default function ModsPage() {
<SectionHeader
title="Mod Packs"
extra={<Space>
{account.hasPermission("core.mod-pack.create") && <ImportModPackButton />}
{account.hasPermission("core.mod-pack.create") && <CreateModPackButton />}
{account.hasPermission("core.mod_pack.create") && <ImportModPackButton />}
{account.hasPermission("core.mod_pack.create") && <CreateModPackButton />}
</Space>}
/>
<Table
+1 -1
View File
@@ -47,7 +47,7 @@ export const pages: PluginPage[] = [
{
path: "/mods",
sidebarName: "Mods",
permission: (account: UserAccount) => account.hasAnyPermission("core.mod.list", "core.mod-pack.list"),
permission: (account: UserAccount) => account.hasAnyPermission("core.mod.list", "core.mod_pack.list"),
content: <ModsPage />,
},
{