mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-20 15:02:31 +00:00
Permissions work
This commit is contained in:
4
training/decorators.py
Normal file
4
training/decorators.py
Normal file
@@ -0,0 +1,4 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user