Skip to content

Commit

Permalink
Merge pull request #899 from AtlasOfLivingAustralia/feature/issue898
Browse files Browse the repository at this point in the history
Explicitly map userName to email field from userdetails #898
  • Loading branch information
salomon-j authored Dec 7, 2023
2 parents 85d1fd5 + 8b20dc1 commit 19236d5
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 19236d5

Please sign in to comment.