##// END OF EJS Templates
caches: flush *all* caches used for permissions.
marcink -
r4331:d4b95196 default
parent child Browse files
Show More
@@ -25,6 +25,15 b' from rhodecode.lib import rc_cache'
25
25
26 log = logging.getLogger(__name__)
26 log = logging.getLogger(__name__)
27
27
28 # names of namespaces used for different permission related cached
29 # during flush operation we need to take care of all those
30 cache_namespaces = [
31 'cache_user_auth.{}',
32 'cache_user_repo_acl_ids.{}',
33 'cache_user_user_group_acl_ids.{}',
34 'cache_user_repo_group_acl_ids.{}'
35 ]
36
28
37
29 def trigger_user_permission_flush(event):
38 def trigger_user_permission_flush(event):
30 """
39 """
@@ -35,9 +44,11 b' def trigger_user_permission_flush(event)'
35
44
36 affected_user_ids = set(event.user_ids)
45 affected_user_ids = set(event.user_ids)
37 for user_id in affected_user_ids:
46 for user_id in affected_user_ids:
38 cache_namespace_uid = 'cache_user_auth.{}'.format(user_id)
47 for cache_namespace_uid_tmpl in cache_namespaces:
39 del_keys = rc_cache.clear_cache_namespace('cache_perms', cache_namespace_uid)
48 cache_namespace_uid = cache_namespace_uid_tmpl.format(user_id)
40 log.debug('Deleted %s cache keys for user_id: %s', del_keys, user_id)
49 del_keys = rc_cache.clear_cache_namespace('cache_perms', cache_namespace_uid)
50 log.debug('Deleted %s cache keys for user_id: %s and namespace %s',
51 del_keys, user_id, cache_namespace_uid)
41
52
42
53
43 def includeme(config):
54 def includeme(config):
General Comments 0
You need to be logged in to leave comments. Login now