Skip to content

Commit

Permalink
Explicitly map userName to email field from userdetails #898
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Dec 7, 2023
1 parent 85d1fd5 commit 8b20dc1
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions grails-app/services/au/org/ala/ecodata/PermissionService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,12 @@ class PermissionService {
if (userList) {
def users = userList['users']

users.each { k, v ->
users.each { k, u ->
Map rec = out.get(k)
if (rec) {
rec.displayName = v?.displayName
rec.userName = v?.userName
rec.displayName = u?.displayName
rec.userName = u?.email ?: u?.userName // This is temporary until we update MERIT / BioCollect to use the email field.
rec.email = u?.email
}
}
}
Expand Down Expand Up @@ -275,11 +276,12 @@ class PermissionService {
if (userList) {
def users = userList['users']

users.each { k, v ->
users.each { k, u ->
Map rec = out.get(k)
if (rec) {
rec.displayName = v?.displayName
rec.userName = v?.userName
rec.displayName = u?.displayName
rec.userName = u?.email ?: u?.userName // This is temporary until we update MERIT / BioCollect to use the email field.
rec.email = u?.email
}
}
}
Expand All @@ -295,7 +297,8 @@ class PermissionService {
rec.role = it.accessLevel?.toString()
rec.userId = it.userId
rec.displayName = u?.displayName
rec.userName = u?.userName
rec.userName = u?.email ?: u?.userName // This is temporary until we update MERIT / BioCollect to use the email field.
rec.email = u?.email
out.add(rec)
}
out
Expand Down Expand Up @@ -347,11 +350,12 @@ class PermissionService {
if (userList) {
def users = userList['users']

users.each { k, v ->
users.each { k, u ->
Map rec = out.get(k)
if (rec) {
rec.displayName = v?.displayName
rec.userName = v?.userName
rec.displayName = u?.displayName
rec.userName = u?.email ?: u?.userName // This is temporary until we update MERIT / BioCollect to use the email field.
rec.email = u?.email
}
}
}
Expand Down Expand Up @@ -399,7 +403,8 @@ class PermissionService {
if (includeUserDetails) {
def u = userService.getUserForUserId(userPermission.userId)
mapped.displayName = u?.displayName
mapped.userName = u?.userName
mapped.userName = u?.email ?: u?.userName // This is temporary until we update MERIT / BioCollect to use the email field.
mapped.email = u?.email
}
mapped
}
Expand Down

0 comments on commit 8b20dc1

Please sign in to comment.