OAuth2 OpenID Connect provider support etc. #3
@@ -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 */ }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user