##// END OF EJS Templates
fixes issue #372...
marcink -
r2090:2632a49c beta
parent child Browse files
Show More
@@ -121,6 +121,7 b' class SimpleGit(BaseVCSController):'
121 121 #======================================================================
122 122 # CHECK ANONYMOUS PERMISSION
123 123 #======================================================================
124
124 125 if action in ['pull', 'push']:
125 126 anonymous_user = self.__get_user('default')
126 127 username = anonymous_user.username
@@ -169,15 +170,13 b' class SimpleGit(BaseVCSController):'
169 170 start_response)
170 171
171 172 #check permissions for this repository
172 perm = self._check_permission(action, user,
173 repo_name)
173 perm = self._check_permission(action, user, repo_name)
174 174 if perm is not True:
175 175 return HTTPForbidden()(environ, start_response)
176 176
177 177 #===================================================================
178 178 # GIT REQUEST HANDLING
179 179 #===================================================================
180
181 180 repo_path = safe_str(os.path.join(self.basepath, repo_name))
182 181 log.debug('Repository path is %s' % repo_path)
183 182
@@ -203,7 +202,6 b' class SimpleGit(BaseVCSController):'
203 202 :param repo_name: name of the repository
204 203 :param repo_path: full path to the repository
205 204 """
206
207 205 _d = {'/' + repo_name: Repo(repo_path)}
208 206 backend = dulserver.DictBackend(_d)
209 207 gitserve = HTTPGitApplication(backend)
@@ -229,19 +227,24 b' class SimpleGit(BaseVCSController):'
229 227 return User.get_by_username(username)
230 228
231 229 def __get_action(self, environ):
232 """Maps git request commands into a pull or push command.
230 """
231 Maps git request commands into a pull or push command.
233 232
234 233 :param environ:
235 234 """
236 235 service = environ['QUERY_STRING'].split('=')
236
237 237 if len(service) > 1:
238 238 service_cmd = service[1]
239 239 mapping = {
240 240 'git-receive-pack': 'push',
241 241 'git-upload-pack': 'pull',
242 242 }
243
244 return mapping.get(service_cmd,
245 service_cmd if service_cmd else 'other')
243 op = mapping[service_cmd]
244 self._git_stored_op = op
245 return op
246 246 else:
247 return 'other'
247 # try to fallback to stored variable as we don't know if the last
248 # operation is pull/push
249 op = getattr(self, '_git_stored_op', 'pull')
250 return op
General Comments 0
You need to be logged in to leave comments. Login now