Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loading/editing users that do not have a role assignment #8590

Merged
merged 3 commits into from Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -118,8 +118,10 @@ export default defineComponent({
roleDisplayName() {
const assignedRole = this.user.appRoleAssignments[0]

return this.$gettext(
this.roles.find((role) => role.id === assignedRole?.appRoleId)?.displayName || ''
return (
this.$gettext(
this.roles.find((role) => role.id === assignedRole?.appRoleId)?.displayName || ''
) || '-'
)
},
groupsDisplayValue() {
Expand Down
Expand Up @@ -346,8 +346,10 @@ export default defineComponent({
getRoleDisplayNameByUser(user) {
const assignedRole = user.appRoleAssignments[0]

return this.$gettext(
this.roles.find((role) => role.id === assignedRole?.appRoleId)?.displayName || ''
return (
this.$gettext(
this.roles.find((role) => role.id === assignedRole?.appRoleId)?.displayName || ''
) || '-'
AlexAndBear marked this conversation as resolved.
Show resolved Hide resolved
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-admin-settings/src/views/Users.vue
Expand Up @@ -696,7 +696,7 @@ export default defineComponent({
updateUserAppRoleAssignments(user, editUser) {
return this.graphClient.users.createUserAppRoleAssignment(user.id, {
appRoleId: editUser.appRoleAssignments[0].appRoleId,
resourceId: editUser.appRoleAssignments[0].resourceId || this.applicationId,
resourceId: this.applicationId,
principalId: editUser.id
})
},
Expand Down