smoke test the rest of the apps
This commit is contained in:
+10
-2
@@ -75,10 +75,18 @@ from loguru import logger
|
||||
class AuthorOrCheckerRequiredMixin(object):
|
||||
def get_object(self, *args, **kwargs):
|
||||
obj = super().get_object(*args, **kwargs)
|
||||
if self.request.user.is_superuser:
|
||||
return obj
|
||||
if self.request.user.groups.filter(name="physics_checker").exists():
|
||||
return obj
|
||||
if self.request.user not in obj.author.all():
|
||||
raise PermissionDenied() # or Http404
|
||||
if hasattr(obj, "author"):
|
||||
if self.request.user not in obj.author.all():
|
||||
raise PermissionDenied()
|
||||
elif hasattr(obj, "user"):
|
||||
if self.request.user != obj.user:
|
||||
raise PermissionDenied()
|
||||
else:
|
||||
raise PermissionDenied()
|
||||
return obj
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user