Repository navigation
Replies: 1 comment
|
Crazy stupid fix that works for now: use EntityTransaction to update each UserEntity, then afterwards iterate through all users and call cache.evict(realm, user) cache being session.getProvider(UserCache.class) I doubt that this is the best way to do it, but its the only one that actually works for me at the moment |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have been trying to set all users in the realm to be disabled (in a custom provider I created) and I can't get it to work.
Also the provider works, the code works in general (I see logging output etc. so thats not the problem)
Below is the code for reference. I have tried using the "runJobInTransaction" function, I have tried using TransactionManager.begin() and .commit() manually, I also tried using EntityManager, but the property does not get updated. Or at least not always. Sometimes some of the users are disabled. I think it also has to do with caching.
The getAllUsers function returns correctly all users. I also checked the DB and there also the users still have the "enabled" property set to true.
For the LDAP full sync however, it can always update the property reliably back to true if I disable it manually, so it does not seem like a bug, but rather a mistake on my side on how I try to update the property. And YES, i have enabled "importUsers" in the LDAP settings, so thats not the problem. Like I said manually disabling works, but using user.setEnabled(false) for some reason does not (reliably) disable users.
Perhaps I need to "force" commit changes to the DB or update the property a different way. Please help me I am almost frustrated.
EDIT: I also tried literally setting the property in the DB (UPDATE user_entity SET enabled false;) ... still the UI shows all users as enabled, so definitely seems like a caching problem
EDIT: removed testing code line
All reactions