diff --git a/static/js/permissions.js b/static/js/permissions.js index cd63797..b2a4f9d 100644 --- a/static/js/permissions.js +++ b/static/js/permissions.js @@ -709,7 +709,7 @@ window.app = Vue.createApp({ } }, - editRole(role) { + async editRole(role) { this.editingRole = true this.selectedRole = role this.roleForm = { @@ -717,6 +717,28 @@ window.app = Vue.createApp({ description: role.description || '', is_default: role.is_default || false } + this.rolePermissionsForView = [] + this.roleUsersForView = [] + + try { + const response = await LNbits.api.request( + 'GET', + `/libra/api/v1/admin/roles/${role.id}`, + this.g.user.wallets[0].adminkey + ) + this.rolePermissionsForView = [...(response.data.permissions || [])] + this.roleUsersForView = [...(response.data.users || [])] + } catch (error) { + console.error('Failed to load role details:', error) + this.$q.notify({ + type: 'negative', + message: 'Failed to load role permissions', + caption: error.message || 'Unknown error', + timeout: 5000 + }) + } + + await this.$nextTick() this.showCreateRoleDialog = true }, @@ -824,6 +846,8 @@ window.app = Vue.createApp({ this.showCreateRoleDialog = false this.editingRole = false this.selectedRole = null + this.roleUsersForView = [] + this.rolePermissionsForView = [] this.resetRoleForm() },