File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
src/main/kotlin/ch/uzh/ifi/access Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,6 @@ class CacheConfig {
3838class CacheInitListener (val cacheInitService : CacheInitService ) : ApplicationListener<ApplicationReadyEvent> {
3939 override fun onApplicationEvent (event : ApplicationReadyEvent ) {
4040 cacheInitService.initCache()
41- // courseService .renameIDs()
41+ cacheInitService .renameIDs()
4242 }
4343}
Original file line number Diff line number Diff 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()
Original file line number Diff line number Diff 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 UserRepresentation and not null
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" }
You can’t perform that action at this time.
0 commit comments