##// END OF EJS Templates
permissions: flush members of user groups permissions to clear caches....
marcink -
r3153:37902585 default
parent child Browse files
Show More
@@ -29,6 +29,8 b' from rhodecode.lib import helpers as h'
29 29 from rhodecode.lib import audit_logger
30 30 from rhodecode.lib.auth import (
31 31 LoginRequired, HasRepoGroupPermissionAnyDecorator, CSRFRequired)
32 from rhodecode.lib.utils2 import safe_int
33 from rhodecode.model.db import UserGroup
32 34 from rhodecode.model.repo_group import RepoGroupModel
33 35 from rhodecode.model.forms import RepoGroupPermsForm
34 36 from rhodecode.model.meta import Session
@@ -101,6 +103,11 b' class RepoGroupPermissionsView(RepoGroup'
101 103 for change in changes['added'] + changes['updated'] + changes['deleted']:
102 104 if change['type'] == 'user':
103 105 affected_user_ids.append(change['id'])
106 if change['type'] == 'user_group':
107 user_group = UserGroup.get(safe_int(change['id']))
108 if user_group:
109 group_members_ids = [x.user_id for x in user_group.members]
110 affected_user_ids.extend(group_members_ids)
104 111
105 112 events.trigger(events.UserPermissionsChange(affected_user_ids))
106 113
@@ -29,6 +29,8 b' from rhodecode.lib import helpers as h'
29 29 from rhodecode.lib import audit_logger
30 30 from rhodecode.lib.auth import (
31 31 LoginRequired, HasRepoPermissionAnyDecorator, CSRFRequired)
32 from rhodecode.lib.utils2 import safe_int
33 from rhodecode.model.db import UserGroup
32 34 from rhodecode.model.forms import RepoPermsForm
33 35 from rhodecode.model.meta import Session
34 36 from rhodecode.model.repo import RepoModel
@@ -88,6 +90,11 b' class RepoSettingsPermissionsView(RepoAp'
88 90 for change in changes['added'] + changes['updated'] + changes['deleted']:
89 91 if change['type'] == 'user':
90 92 affected_user_ids.append(change['id'])
93 if change['type'] == 'user_group':
94 user_group = UserGroup.get(safe_int(change['id']))
95 if user_group:
96 group_members_ids = [x.user_id for x in user_group.members]
97 affected_user_ids.extend(group_members_ids)
91 98
92 99 events.trigger(events.UserPermissionsChange(affected_user_ids))
93 100
@@ -40,8 +40,8 b' from rhodecode.apps._base import UserGro'
40 40 from rhodecode.lib.auth import (
41 41 LoginRequired, HasUserGroupPermissionAnyDecorator, CSRFRequired)
42 42 from rhodecode.lib import helpers as h, audit_logger
43 from rhodecode.lib.utils2 import str2bool
44 from rhodecode.model.db import User
43 from rhodecode.lib.utils2 import str2bool, safe_int
44 from rhodecode.model.db import User, UserGroup
45 45 from rhodecode.model.meta import Session
46 46 from rhodecode.model.user_group import UserGroupModel
47 47
@@ -377,6 +377,11 b' class UserGroupsView(UserGroupAppView):'
377 377 for change in changes['added'] + changes['updated'] + changes['deleted']:
378 378 if change['type'] == 'user':
379 379 affected_user_ids.append(change['id'])
380 if change['type'] == 'user_group':
381 user_group = UserGroup.get(safe_int(change['id']))
382 if user_group:
383 group_members_ids = [x.user_id for x in user_group.members]
384 affected_user_ids.extend(group_members_ids)
380 385
381 386 events.trigger(events.UserPermissionsChange(affected_user_ids))
382 387
General Comments 0
You need to be logged in to leave comments. Login now