Skip to content

Commit 7504385

Browse files
committed
debug for staging user management
1 parent bc0983a commit 7504385

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/main/kotlin/ch/uzh/ifi/access/service/CourseService.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,12 @@ class CourseService(
329329
val newUsersSet = registrationIDs.toSet()
330330
val existingUsersSet = existingUsers.toSet()
331331

332+
logger.debug { "existingUsersSet: $existingUsers" }
333+
logger.debug { "newUsersSet: $newUsersSet" }
332334
val removedUsers = existingUsersSet.minus(newUsersSet).toList()
333335
val addedUsers = newUsersSet.minus(existingUsersSet).toList()
336+
logger.debug { "removedUsers: $removedUsers" }
337+
logger.debug { "addedUsers: $addedUsers" }
334338

335339
when (role) {
336340
Role.SUPERVISOR -> course.supervisors = newUsersSet.toMutableSet()

src/main/kotlin/ch/uzh/ifi/access/service/RoleService.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ class RoleService(
213213
fun initializeUserRoles(username: String) {
214214
try {
215215
semaphore.acquire()
216+
// evict the username to ensure we get a fresh UserRepresentation
217+
// this only happens on first login anyway, and should not be necessary,
218+
// but if someone deletes a user from Keycloak manually, then the caching is broken even after a reboot
219+
cacheManager.getCache("RoleService.findUserByAllCriteria")?.evict(username);
216220
val user = proxy.findUserByAllCriteria(username)
217221
if (user == null) {
218222
logger.error { "Trying to initialize roles for $username: no matching username in Keycloak" }

0 commit comments

Comments
 (0)