From 483e93416f56ac902b291f82071ada5b81440fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Mon, 2 Dec 2024 13:40:24 +0100 Subject: [PATCH] Fix contextual role editing in Admin Area --- client/web/admin/src/components/Role/CRoleEditorInfo.vue | 3 +++ client/web/admin/src/views/System/Role/Editor.vue | 2 +- lib/js/src/system/types/role.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/web/admin/src/components/Role/CRoleEditorInfo.vue b/client/web/admin/src/components/Role/CRoleEditorInfo.vue index 21b945e6a0..d25c5dd388 100644 --- a/client/web/admin/src/components/Role/CRoleEditorInfo.vue +++ b/client/web/admin/src/components/Role/CRoleEditorInfo.vue @@ -229,6 +229,9 @@ export default { }, set (isContext) { + this.role.meta.context.resourceTypes = [] + this.role.meta.context.expr = '' + this.$emit('update:is-context', isContext) }, }, diff --git a/client/web/admin/src/views/System/Role/Editor.vue b/client/web/admin/src/views/System/Role/Editor.vue index f267dbb152..db8cb2f31e 100644 --- a/client/web/admin/src/views/System/Role/Editor.vue +++ b/client/web/admin/src/views/System/Role/Editor.vue @@ -236,7 +236,7 @@ export default { if (this.roleID) { this.$SystemAPI.roleUpdate(role) - .then(role => { + .then(() => { this.fetchRole() this.animateSuccess('info') diff --git a/lib/js/src/system/types/role.ts b/lib/js/src/system/types/role.ts index 1f3d12a3d7..cc5f1f0f4a 100644 --- a/lib/js/src/system/types/role.ts +++ b/lib/js/src/system/types/role.ts @@ -98,7 +98,7 @@ export class Role { } get isContext (): boolean { - return this.meta?.context?.expr?.length > 0 + return this.meta?.context?.expr?.length > 0 || this.meta?.context?.resourceTypes?.length > 0 } clone (): Role {