17 lines
466 B
Python
Executable File
17 lines
466 B
Python
Executable File
from django.core.exceptions import PermissionDenied
|
|
|
|
|
|
def user_is_cid_user_manager(function):
|
|
def wrap(request, *args, **kwargs):
|
|
if (
|
|
request.user.groups.filter(name="cid_user_manager").exists()
|
|
or request.user.is_superuser
|
|
):
|
|
return function(request, *args, **kwargs)
|
|
else:
|
|
raise PermissionDenied
|
|
|
|
wrap.__doc__ = function.__doc__
|
|
wrap.__name__ = function.__name__
|
|
return wrap
|