##// END OF EJS Templates
possible fix for #486 undefined variable username...
marcink -
r2500:94ef0b60 beta
parent child Browse files
Show More
@@ -167,21 +167,20 b' class SimpleGit(BaseVCSController):'
167 #==============================================================
167 #==============================================================
168 # CHECK PERMISSIONS FOR THIS REQUEST USING GIVEN USERNAME
168 # CHECK PERMISSIONS FOR THIS REQUEST USING GIVEN USERNAME
169 #==============================================================
169 #==============================================================
170 if action in ['pull', 'push']:
170 try:
171 try:
171 user = self.__get_user(username)
172 user = self.__get_user(username)
172 if user is None or not user.active:
173 if user is None or not user.active:
173 return HTTPForbidden()(environ, start_response)
174 return HTTPForbidden()(environ, start_response)
174 username = user.username
175 username = user.username
175 except:
176 except:
176 log.error(traceback.format_exc())
177 log.error(traceback.format_exc())
177 return HTTPInternalServerError()(environ, start_response)
178 return HTTPInternalServerError()(environ,
179 start_response)
180
178
181 #check permissions for this repository
179 #check permissions for this repository
182 perm = self._check_permission(action, user, repo_name)
180 perm = self._check_permission(action, user, repo_name)
183 if perm is not True:
181 if perm is not True:
184 return HTTPForbidden()(environ, start_response)
182 return HTTPForbidden()(environ, start_response)
183
185 extras = {
184 extras = {
186 'ip': ipaddr,
185 'ip': ipaddr,
187 'username': username,
186 'username': username,
@@ -70,7 +70,7 b' class SimpleHg(BaseVCSController):'
70 return self.application(environ, start_response)
70 return self.application(environ, start_response)
71
71
72 ipaddr = self._get_ip_addr(environ)
72 ipaddr = self._get_ip_addr(environ)
73
73 username = None
74 # skip passing error to error controller
74 # skip passing error to error controller
75 environ['pylons.status_code_redirect'] = True
75 environ['pylons.status_code_redirect'] = True
76
76
@@ -131,21 +131,19 b' class SimpleHg(BaseVCSController):'
131 #==============================================================
131 #==============================================================
132 # CHECK PERMISSIONS FOR THIS REQUEST USING GIVEN USERNAME
132 # CHECK PERMISSIONS FOR THIS REQUEST USING GIVEN USERNAME
133 #==============================================================
133 #==============================================================
134 if action in ['pull', 'push']:
134 try:
135 try:
135 user = self.__get_user(username)
136 user = self.__get_user(username)
136 if user is None or not user.active:
137 if user is None or not user.active:
137 return HTTPForbidden()(environ, start_response)
138 return HTTPForbidden()(environ, start_response)
138 username = user.username
139 username = user.username
139 except:
140 except:
140 log.error(traceback.format_exc())
141 log.error(traceback.format_exc())
141 return HTTPInternalServerError()(environ, start_response)
142 return HTTPInternalServerError()(environ,
143 start_response)
144
142
145 #check permissions for this repository
143 #check permissions for this repository
146 perm = self._check_permission(action, user, repo_name)
144 perm = self._check_permission(action, user, repo_name)
147 if perm is not True:
145 if perm is not True:
148 return HTTPForbidden()(environ, start_response)
146 return HTTPForbidden()(environ, start_response)
149
147
150 # extras are injected into mercurial UI object and later available
148 # extras are injected into mercurial UI object and later available
151 # in hg hooks executed by rhodecode
149 # in hg hooks executed by rhodecode
General Comments 0
You need to be logged in to leave comments. Login now