diff options
author | Andrew Godwin | 2022-11-16 21:14:05 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-16 21:14:05 -0700 |
commit | 9d97fc92d82289301896c88f8c828321aa99701d (patch) | |
tree | 1ea94bcae7531ed28962ab64188734cb89aa673e /users/decorators.py | |
parent | 1b52acdb56346d939eb2e26ff449697b52fa7142 (diff) | |
download | takahe-9d97fc92d82289301896c88f8c828321aa99701d.tar.gz takahe-9d97fc92d82289301896c88f8c828321aa99701d.tar.bz2 takahe-9d97fc92d82289301896c88f8c828321aa99701d.zip |
Should probably limit system settings to admins
Diffstat (limited to 'users/decorators.py')
-rw-r--r-- | users/decorators.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/users/decorators.py b/users/decorators.py index d373692..5226460 100644 --- a/users/decorators.py +++ b/users/decorators.py @@ -1,5 +1,6 @@ from functools import wraps +from django.contrib.auth.decorators import user_passes_test from django.contrib.auth.views import redirect_to_login from django.http import HttpResponseRedirect @@ -26,3 +27,7 @@ def identity_required(function): return function(request, *args, **kwargs) return inner + + +def admin_required(function): + return user_passes_test(lambda user: user.admin)(function) |