Cleanup in tblSynchedUser and tblSynchedUserRole?

Vote:
 

Hi!
I have built a solution where login is done via OpenIdConnect.
It works well and users are synced to the table tblSynchedUser and roles are synced to the table tblSynchedUserRole in the database.
My question is if any cleanup happens in these tables if a user or a role disappears?

I realize that the database cannot keep track of this as the synchronization takes place when someone logs in and that it does not know if a user or
a role disappears, but I'm thinking if a cleanup happens if e.g. a user has not logged in for the last x months or similar.

Best regards
Kristian

#290982
Nov 02, 2022 12:23
Vote:
 

Hi, there is a function you can call to remove inactive users; EPiServer.Security.Internal.ISynchronizedUsersRepository.DeleteInactiveUsersAsync(timespan);. We do not clean up these tables automatically, since we do not know when a user or role has been removed. You could call this method from a scheduled job.

#291179
Nov 06, 2022 11:29
Vote:
 

Thanks!

I noticed that DeleteInactiveUsersAsync is in CMS 12. I guess I'll have to wait until we upgrade from version 11 before I can use it.

Best regards
Kristian

#291226
Edited, Nov 07, 2022 13:12
Vote:
 

Yes, the problem is that in CMS11 we're not storing the last login date.

#291227
Nov 07, 2022 13:14
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.