From 36b9d6b83060ab55a6f3cf028d88c3f06e4e9e50 Mon Sep 17 00:00:00 2001 From: Carol Alexandru Date: Sat, 7 Sep 2024 10:01:53 +0900 Subject: [PATCH] also match users by LinkedAffiliationMail --- src/main/kotlin/ch/uzh/ifi/access/service/RoleService.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ch/uzh/ifi/access/service/RoleService.kt b/src/main/kotlin/ch/uzh/ifi/access/service/RoleService.kt index 7223a48..4dfdae3 100644 --- a/src/main/kotlin/ch/uzh/ifi/access/service/RoleService.kt +++ b/src/main/kotlin/ch/uzh/ifi/access/service/RoleService.kt @@ -104,17 +104,19 @@ class RoleService( fun studentMatchesUser(student: String, user: UserRepresentation): Boolean { val matchByUsername = user.username == student val matchByAffiliationID = user.attributes?.get("swissEduIDLinkedAffiliationUniqueID")?.any { it == student } == true + val matchByAffiliationEmail = user.attributes?.get("swissEduIDLinkedAffiliationMail")?.any { it == student } == true val matchByPersonID = user.attributes?.get("swissEduPersonUniqueID")?.any { it == student } == true val matchByEmail = user.email == student - return (matchByUsername || matchByAffiliationID || matchByPersonID || matchByEmail) + return (matchByUsername || matchByAffiliationID || matchByAffiliationEmail || matchByPersonID || matchByEmail) } fun userRegisteredForCourse(user: UserRepresentation, registrationIDs: Set): Boolean { val matchByUsername = user.username in registrationIDs val matchByAffiliationID = user.attributes?.get("swissEduIDLinkedAffiliationUniqueID")?.any { it in registrationIDs } == true + val matchByAffiliationEmail = user.attributes?.get("swissEduIDLinkedAffiliationMail")?.any { it in registrationIDs } == true val matchByPersonID = user.attributes?.get("swissEduPersonUniqueID")?.any { it in registrationIDs } == true val matchByEmail = user.email in registrationIDs - return (matchByUsername || matchByAffiliationID || matchByPersonID || matchByEmail) + return (matchByUsername || matchByAffiliationID || matchByAffiliationEmail || matchByPersonID || matchByEmail) } fun updateRoleTimestamp(user: UserRepresentation): UserRepresentation {