Rename save.list.subscribe permission

Follow the same pattern as all the other subscribable lists by having a
separate .list and .subscribe permissions for saves.  This also fixes
the save list not being visible due to a typo in the permission in the
Web UI.
This commit is contained in:
Hornwitser committed 2024-02-06 22:43:04 +01:00
1 parent 2df67e32da
commit 535e43b527
5 files changed
+15 -6

No files matched your search

+1
View File
@@ -8,6 +8,7 @@
- Fixed an unhandled rejection in disconnect logic crashing the host. - Fixed an unhandled rejection in disconnect logic crashing the host.
- Fixed instance screen in Web UI not updating when an instance was reassigned. - 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 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.
## Version 2.0.0-alpha.16 ## Version 2.0.0-alpha.16
+9 -1
View File
@@ -19,12 +19,20 @@ export default class Role {
permissions: Type.Array(Type.String()), permissions: Type.Array(Type.String()),
}); });
static remapPermission(permission: string) {
// migrate: core.instance.save.list.subscribe was renamed in alpha 17
if (permission === "core.instance.save.list.subscribe") {
return "core.instance.save.subscribe";
}
return permission;
}
static fromJSON(json: Static<typeof this.jsonSchema>) { static fromJSON(json: Static<typeof this.jsonSchema>) {
return new this( return new this(
json.id, json.id,
json.name, json.name,
json.description, json.description,
new Set(json.permissions), new Set(json.permissions.map(this.remapPermission)),
); );
} }
+1 -1
View File
@@ -361,7 +361,7 @@ export class InstanceSaveDetailsUpdatesEvent {
static type = "event" as const; static type = "event" as const;
static src = ["instance", "host", "controller"] as const; static src = ["instance", "host", "controller"] as const;
static dst = ["controller", "control"] as const; static dst = ["controller", "control"] as const;
static permission = "core.instance.save.list.subscribe" as const; static permission = "core.instance.save.subscribe" as const;
constructor( constructor(
public updates: SaveDetails[], public updates: SaveDetails[],
+3 -3
View File
@@ -239,11 +239,11 @@ definePermission({
definePermission({ definePermission({
name: "core.instance.save.list", name: "core.instance.save.list",
title: "List saves", title: "List saves",
description: "List the saves currently on the instance.", description: "List the saves currently on instances.",
}); });
definePermission({ definePermission({
name: "core.instance.save.list.subscribe", name: "core.instance.save.subscribe",
title: "Subscribe to save list updatess", title: "Subscribe to save updates",
description: "Subscribe to be notifed on updates to the list of saves of instances.", description: "Subscribe to be notifed on updates to the list of saves of instances.",
}); });
definePermission({ definePermission({
@@ -204,7 +204,7 @@ export default function InstanceViewPage() {
<InstanceDescription host={host} instance={instance} /> <InstanceDescription host={host} instance={instance} />
{ {
account.hasAllPermission("core.instance.save.list", "core.instance.save.list_subscribe") account.hasAllPermission("core.instance.save.list", "core.instance.save.subscribe")
&& <SavesList instance={instance} /> && <SavesList instance={instance} />
} }
{ {