This commit is contained in:
2022-01-04 12:08:17 +00:00
parent 2a2f010028
commit fbe4d7271f
5 changed files with 21 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
from PyRIGS.decorators import user_passes_test_with_403
def has_perm_or_supervisor(perm, login_url=None, oembed_view=None):
return user_passes_test_with_403(lambda u: (hasattr(u, 'as_trainee') and u.as_trainee.is_supervisor) or u.has_perm(perm), login_url=login_url, oembed_view=oembed_view)