INNER CODE UNIT · Python
pro_permission_required
Patrowl/PatrowlManager · common/utils/__init__.py:4
def pro_permission_required(*args):
"""
Check user has any of the given permissions.
Permission required can not be used in its place as that takes only a
single permission.
"""
def test_func(user):
from django.conf import settings
if not settings.PRO_EDITION or user.is_superuser:
return True
for perm in args:
if user.has_perm(perm):
return True
return False
return user_passes_test(test_func)