Show More
@@ -218,7 +218,7 b' class HasPermissionAllDecorator(PermsDec' | |||
|
218 | 218 | """ |
|
219 | 219 | |
|
220 | 220 | def check_permissions(self): |
|
221 |
if self.required_perms.issubset(self.user_perms |
|
|
221 | if self.required_perms.issubset(self.user_perms.get('global')): | |
|
222 | 222 | return True |
|
223 | 223 | return False |
|
224 | 224 | |
@@ -230,7 +230,7 b' class HasPermissionAnyDecorator(PermsDec' | |||
|
230 | 230 | """ |
|
231 | 231 | |
|
232 | 232 | def check_permissions(self): |
|
233 |
if self.required_perms.intersection(self.user_perms |
|
|
233 | if self.required_perms.intersection(self.user_perms.get('global')): | |
|
234 | 234 | return True |
|
235 | 235 | return False |
|
236 | 236 | |
@@ -242,7 +242,10 b' class HasRepoPermissionAllDecorator(Perm' | |||
|
242 | 242 | |
|
243 | 243 | def check_permissions(self): |
|
244 | 244 | repo_name = get_repo_slug(request) |
|
245 | user_perms = set([self.user_perms['repositories'][repo_name]]) | |
|
245 | try: | |
|
246 | user_perms = set([self.user_perms['repositories'][repo_name]]) | |
|
247 | except KeyError: | |
|
248 | return False | |
|
246 | 249 | if self.required_perms.issubset(user_perms): |
|
247 | 250 | return True |
|
248 | 251 | return False |
@@ -257,7 +260,10 b' class HasRepoPermissionAnyDecorator(Perm' | |||
|
257 | 260 | def check_permissions(self): |
|
258 | 261 | repo_name = get_repo_slug(request) |
|
259 | 262 | |
|
260 | user_perms = set([self.user_perms['repositories'][repo_name]]) | |
|
263 | try: | |
|
264 | user_perms = set([self.user_perms['repositories'][repo_name]]) | |
|
265 | except KeyError: | |
|
266 | return False | |
|
261 | 267 | if self.required_perms.intersection(user_perms): |
|
262 | 268 | return True |
|
263 | 269 | return False |
@@ -307,13 +313,13 b' class PermsFunction(object):' | |||
|
307 | 313 | |
|
308 | 314 | class HasPermissionAll(PermsFunction): |
|
309 | 315 | def check_permissions(self): |
|
310 |
if self.required_perms.issubset(self.user_perms |
|
|
316 | if self.required_perms.issubset(self.user_perms.get('global')): | |
|
311 | 317 | return True |
|
312 | 318 | return False |
|
313 | 319 | |
|
314 | 320 | class HasPermissionAny(PermsFunction): |
|
315 | 321 | def check_permissions(self): |
|
316 |
if self.required_perms.intersection(self.user_perms |
|
|
322 | if self.required_perms.intersection(self.user_perms.get('global')): | |
|
317 | 323 | return True |
|
318 | 324 | return False |
|
319 | 325 | |
@@ -327,8 +333,11 b' class HasRepoPermissionAll(PermsFunction' | |||
|
327 | 333 | if not self.repo_name: |
|
328 | 334 | self.repo_name = get_repo_slug(request) |
|
329 | 335 | |
|
330 | self.user_perms = set([self.user_perms['repositories']\ | |
|
331 | .get(self.repo_name)]) | |
|
336 | try: | |
|
337 | self.user_perms = set([self.user_perms['repositories']\ | |
|
338 | [self.repo_name]]) | |
|
339 | except KeyError: | |
|
340 | return False | |
|
332 | 341 | self.granted_for = self.repo_name |
|
333 | 342 | if self.required_perms.issubset(self.user_perms): |
|
334 | 343 | return True |
@@ -345,8 +354,11 b' class HasRepoPermissionAny(PermsFunction' | |||
|
345 | 354 | if not self.repo_name: |
|
346 | 355 | self.repo_name = get_repo_slug(request) |
|
347 | 356 | |
|
348 | self.user_perms = set([self.user_perms['repositories']\ | |
|
349 | .get(self.repo_name)]) | |
|
357 | try: | |
|
358 | self.user_perms = set([self.user_perms['repositories']\ | |
|
359 | [self.repo_name]]) | |
|
360 | except KeyError: | |
|
361 | return False | |
|
350 | 362 | self.granted_for = self.repo_name |
|
351 | 363 | if self.required_perms.intersection(self.user_perms): |
|
352 | 364 | return True |
General Comments 0
You need to be logged in to leave comments.
Login now