Show More
@@ -180,13 +180,8 b' class AdminReposView(BaseAppView, DataGr' | |||||
180 |
|
180 | |||
181 | affected_user_ids = [self._rhodecode_user.user_id] |
|
181 | affected_user_ids = [self._rhodecode_user.user_id] | |
182 | if copy_permissions: |
|
182 | if copy_permissions: | |
183 | repository = Repository.get_by_repo_name(repo_name) |
|
183 | # permission flush is done in repo creating | |
184 | # also include those newly created by copy |
|
184 | pass | |
185 | user_group_perms = repository.permissions(expand_from_user_groups=True) |
|
|||
186 | copy_perms = [perm['user_id'] for perm in user_group_perms] |
|
|||
187 | # also include those newly created by copy |
|
|||
188 | affected_user_ids.extend(copy_perms) |
|
|||
189 |
|
||||
190 | events.trigger(events.UserPermissionsChange(affected_user_ids)) |
|
185 | events.trigger(events.UserPermissionsChange(affected_user_ids)) | |
191 |
|
186 | |||
192 | raise HTTPFound( |
|
187 | raise HTTPFound( |
@@ -23,6 +23,7 b' import logging' | |||||
23 | from pyramid.view import view_config |
|
23 | from pyramid.view import view_config | |
24 | from pyramid.httpexceptions import HTTPFound, HTTPNotFound |
|
24 | from pyramid.httpexceptions import HTTPFound, HTTPNotFound | |
25 |
|
25 | |||
|
26 | from rhodecode import events | |||
26 | from rhodecode.apps._base import BaseAppView |
|
27 | from rhodecode.apps._base import BaseAppView | |
27 | from rhodecode.lib import helpers as h |
|
28 | from rhodecode.lib import helpers as h | |
28 | from rhodecode.lib.auth import (NotAnonymous, HasRepoPermissionAny) |
|
29 | from rhodecode.lib.auth import (NotAnonymous, HasRepoPermissionAny) | |
@@ -50,6 +51,8 b' class RepoChecksView(BaseAppView):' | |||||
50 |
|
51 | |||
51 | # check if maybe repo is already created |
|
52 | # check if maybe repo is already created | |
52 | if db_repo and db_repo.repo_state in [Repository.STATE_CREATED]: |
|
53 | if db_repo and db_repo.repo_state in [Repository.STATE_CREATED]: | |
|
54 | self.flush_permissions_on_creation(db_repo) | |||
|
55 | ||||
53 | # re-check permissions before redirecting to prevent resource |
|
56 | # re-check permissions before redirecting to prevent resource | |
54 | # discovery by checking the 302 code |
|
57 | # discovery by checking the 302 code | |
55 | perm_set = ['repository.read', 'repository.write', 'repository.admin'] |
|
58 | perm_set = ['repository.read', 'repository.write', 'repository.admin'] | |
@@ -110,5 +113,13 b' class RepoChecksView(BaseAppView):' | |||||
110 | else: |
|
113 | else: | |
111 | h.flash(h.literal(_('Created repository %s') % repo_url), |
|
114 | h.flash(h.literal(_('Created repository %s') % repo_url), | |
112 | category='success') |
|
115 | category='success') | |
|
116 | self.flush_permissions_on_creation(db_repo) | |||
|
117 | ||||
113 | return {'result': True} |
|
118 | return {'result': True} | |
114 | return {'result': False} |
|
119 | return {'result': False} | |
|
120 | ||||
|
121 | def flush_permissions_on_creation(self, db_repo): | |||
|
122 | # repo is finished and created, we flush the permissions now | |||
|
123 | user_group_perms = db_repo.permissions(expand_from_user_groups=True) | |||
|
124 | affected_user_ids = [perm['user_id'] for perm in user_group_perms] | |||
|
125 | events.trigger(events.UserPermissionsChange(affected_user_ids)) |
@@ -256,12 +256,8 b' class RepoForksView(RepoAppView, DataGri' | |||||
256 |
|
256 | |||
257 | affected_user_ids = [self._rhodecode_user.user_id] |
|
257 | affected_user_ids = [self._rhodecode_user.user_id] | |
258 | if copy_permissions: |
|
258 | if copy_permissions: | |
259 | repository = Repository.get_by_repo_name(repo_name) |
|
259 | # permission flush is done in repo creating | |
260 | # also include those newly created by copy |
|
260 | pass | |
261 | user_group_perms = repository.permissions(expand_from_user_groups=True) |
|
|||
262 | copy_perms = [perm['user_id'] for perm in user_group_perms] |
|
|||
263 | # also include those newly created by copy |
|
|||
264 | affected_user_ids.extend(copy_perms) |
|
|||
265 |
|
261 | |||
266 | events.trigger(events.UserPermissionsChange(affected_user_ids)) |
|
262 | events.trigger(events.UserPermissionsChange(affected_user_ids)) | |
267 |
|
263 |
General Comments 0
You need to be logged in to leave comments.
Login now