smoke test the rest of the apps

This commit is contained in:
Ross
2026-06-10 22:05:12 +01:00
parent e670adf2d0
commit 6bb9441748
55 changed files with 1454 additions and 109 deletions
+10 -2
View File
@@ -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