clone rapids app into longs
This commit is contained in:
Executable
+13
@@ -0,0 +1,13 @@
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from .models import Rapid
|
||||
|
||||
def user_is_author_or_rapid_checker(function):
|
||||
def wrap(request, *args, **kwargs):
|
||||
rapid = Rapid.objects.get(pk=kwargs['pk'])
|
||||
if request.user in rapid.author.all() or request.user.groups.filter(name='rapid_checker').exists():
|
||||
return function(request, *args, **kwargs)
|
||||
else:
|
||||
raise PermissionDenied
|
||||
wrap.__doc__ = function.__doc__
|
||||
wrap.__name__ = function.__name__
|
||||
return wrap
|
||||
Reference in New Issue
Block a user