This commit is contained in:
Ross
2021-07-26 22:59:16 +01:00
parent 08eb27bc0b
commit 21ca245637
2 changed files with 14 additions and 4 deletions
+10
View File
@@ -11,3 +11,13 @@ def user_is_author_or_long_checker(function):
wrap.__doc__ = function.__doc__
wrap.__name__ = function.__name__
return wrap
def user_is_long_checker(function):
def wrap(request, *args, **kwargs):
if request.user.groups.filter(name='long_checker').exists() or request.user.is_superuser:
return function(request, *args, **kwargs)
else:
raise PermissionDenied
wrap.__doc__ = function.__doc__
wrap.__name__ = function.__name__
return wrap