By: Kee Wee Wong named 30 Mar 2020 at 11:13 p.m. CDT

2 Responses
Kee Wee Wong gravatar
Hi Support, I've written a custom script for cache refresh to populate the user role based on the existence of a user attribute synced in. ``` def updateUser(self, user, configurationAttributes): print "Cache refresh. UpdateUser method" attributes = user.getCustomAttributes() attr1 = user.getAttribute("attr1") attr2 = user.getAttribute("attr2") print "attr1 is: %s" % attr1 print "attr2 is: %s" % attr1 # Check if attr1 or attr2 is present and set role accordingly if attr1: print "User is Role1" role = GluuCustomAttribute("role", "Role1") attributes.add(role) elif attr2: print "User is Role2" role = GluuCustomAttribute("role", "Role2") attributes.add(role) return True ``` However, when I enabled the script and ran cache refresh, only new users or users with changes are updated. Is it possible to re-run the cache refresh on the entire user population so that I can add in the role attribute for all the users already synced in?

By Mohib Zico staff 31 Mar 2020 at 5:41 a.m. CDT

Mohib Zico gravatar
Hello Kee Wee, >> Is it possible to re-run the cache refresh on the entire user population so that I can add in the role attribute for all the users already synced in? Yes, possible. - Stop Cache Refresh - Remove files under 'snapshot' directory. [ there is a location specified in Cache Refresh page, if you can't find that.. let me know please] - Start Cache Refresh again. Removing snapshot file instruct IDP to 'force' CR to run from scratch.

By Kee Wee Wong named 31 Mar 2020 at 6:56 a.m. CDT

Kee Wee Wong gravatar
Hi Mohib, Thanks for the valuable info!