Skip to content

Commit

Permalink
also match users by LinkedAffiliationMail
Browse files Browse the repository at this point in the history
  • Loading branch information
sealexan committed Sep 7, 2024
1 parent c723d97 commit 36b9d6b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/ch/uzh/ifi/access/service/RoleService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>): 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 {
Expand Down

0 comments on commit 36b9d6b

Please sign in to comment.