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