Fix a bug with moving users to different roles, still using old data structures.

This commit is contained in:
Leo Vasanko
2026-02-18 02:23:19 +00:00
parent ee35e6b1ad
commit e02ec82ff3
+4 -4
View File
@@ -324,10 +324,10 @@ async function performUserDeletion(userUuid, userName, orgUuid) {
}
}
async function moveUserToRole(user, targetRoleUuid) {
if (user.role_uuid === targetRoleUuid) return
async function moveUserToRole(userUuid, user, targetRoleUuid) {
if (user.role === targetRoleUuid) return
try {
await apiJson(`/auth/api/admin/users/${user.uuid}/role`, {
await apiJson(`/auth/api/admin/users/${userUuid}/role`, {
method: 'PATCH',
body: { role_uuid: targetRoleUuid }
})
@@ -353,7 +353,7 @@ function onRoleDrop(e, org, role) {
const data = JSON.parse(e.dataTransfer.getData('text/plain'))
if (data.org !== org.uuid) return // only within same org
const user = org.users[data.user_uuid]
if (user) moveUserToRole(user, role.uuid)
if (user) moveUserToRole(data.user_uuid, user, role.uuid)
} catch (_) { /* ignore */ }
}