Show More
@@ -163,7 +163,8 b' def get_access_path(environ):' | |||
|
163 | 163 | |
|
164 | 164 | |
|
165 | 165 | def vcs_operation_context( |
|
166 |
environ, repo_name, username, action, scm, check_locking=True |
|
|
166 | environ, repo_name, username, action, scm, check_locking=True, | |
|
167 | is_shadow_repo=False): | |
|
167 | 168 | """ |
|
168 | 169 | Generate the context for a vcs operation, e.g. push or pull. |
|
169 | 170 | |
@@ -200,6 +201,7 b' def vcs_operation_context(' | |||
|
200 | 201 | 'locked_by': locked_by, |
|
201 | 202 | 'server_url': utils2.get_server_url(environ), |
|
202 | 203 | 'hooks': get_enabled_hook_classes(ui_settings), |
|
204 | 'is_shadow_repo': is_shadow_repo, | |
|
203 | 205 | } |
|
204 | 206 | return extras |
|
205 | 207 |
@@ -109,7 +109,7 b' class SimpleVCS(object):' | |||
|
109 | 109 | def set_repo_names(self, environ): |
|
110 | 110 | """ |
|
111 | 111 | This will populate the attributes acl_repo_name, url_repo_name, |
|
112 |
vcs_repo_name and |
|
|
112 | vcs_repo_name and is_shadow_repo on the current instance. | |
|
113 | 113 | """ |
|
114 | 114 | # TODO: martinb: Move to class or module scope. |
|
115 | 115 | # TODO: martinb: Check if we have to use re.UNICODE. |
@@ -143,14 +143,14 b' class SimpleVCS(object):' | |||
|
143 | 143 | workspace_id) |
|
144 | 144 | |
|
145 | 145 | # Store names for later usage. |
|
146 | self.pr_id = pr_id | |
|
147 | 146 | self.vcs_repo_name = vcs_repo_name |
|
148 | 147 | self.acl_repo_name = pull_request.target_repo.repo_name |
|
148 | self.is_shadow_repo = True | |
|
149 | 149 | else: |
|
150 | 150 | # All names are equal for normal (non shadow) repositories. |
|
151 | 151 | self.acl_repo_name = self.url_repo_name |
|
152 | 152 | self.vcs_repo_name = self.url_repo_name |
|
153 |
self. |
|
|
153 | self.is_shadow_repo = False | |
|
154 | 154 | |
|
155 | 155 | @property |
|
156 | 156 | def scm_app(self): |
@@ -305,7 +305,7 b' class SimpleVCS(object):' | |||
|
305 | 305 | # Check if this is a request to a shadow repository of a pull request. |
|
306 | 306 | # In this case only pull action is allowed. |
|
307 | 307 | # ====================================================================== |
|
308 |
if self. |
|
|
308 | if self.is_shadow_repo and action != 'pull': | |
|
309 | 309 | reason = 'Only pull action is allowed for shadow repositories.' |
|
310 | 310 | log.debug('User not allowed to proceed, %s', reason) |
|
311 | 311 | return HTTPNotAcceptable(reason)(environ, start_response) |
@@ -393,8 +393,9 b' class SimpleVCS(object):' | |||
|
393 | 393 | check_locking = _should_check_locking(environ.get('QUERY_STRING')) |
|
394 | 394 | extras = vcs_operation_context( |
|
395 | 395 | environ, repo_name=self.acl_repo_name, username=username, |
|
396 | action=action, scm=self.SCM, | |
|
397 | check_locking=check_locking) | |
|
396 | action=action, scm=self.SCM, check_locking=check_locking, | |
|
397 | is_shadow_repo=self.is_shadow_repo | |
|
398 | ) | |
|
398 | 399 | |
|
399 | 400 | # ====================================================================== |
|
400 | 401 | # REQUEST HANDLING |
General Comments 0
You need to be logged in to leave comments.
Login now