From 8b20dc1031af7a90ce674806c1255d619047867a Mon Sep 17 00:00:00 2001 From: chrisala Date: Fri, 8 Dec 2023 08:20:54 +1100 Subject: [PATCH] Explicitly map userName to email field from userdetails #898 --- .../org/ala/ecodata/PermissionService.groovy | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/grails-app/services/au/org/ala/ecodata/PermissionService.groovy b/grails-app/services/au/org/ala/ecodata/PermissionService.groovy index 6b1f9e811..f84e106c3 100644 --- a/grails-app/services/au/org/ala/ecodata/PermissionService.groovy +++ b/grails-app/services/au/org/ala/ecodata/PermissionService.groovy @@ -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 } } } @@ -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 } } } @@ -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 @@ -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 } } } @@ -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 }