mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Implement middleware for admin views
- Add AdminMiddleware to deny non admin users - Add decorator to mark views as "non admin"
This commit is contained in:
1 parent
c8fb2c35c4
commit
3b23f78bdc
5 files changed
+125
-6
No files matched your search
+8
-1
@@ -16,7 +16,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Miscelleneous utility method.
|
||||
Miscellaneous utility methods.
|
||||
"""
|
||||
|
||||
import importlib
|
||||
@@ -44,3 +44,10 @@ def _format_lazy(string, *args, **kwargs):
|
||||
|
||||
|
||||
format_lazy = lazy(_format_lazy, str)
|
||||
|
||||
|
||||
def non_admin_view(func):
|
||||
"""Decorator to mark a view as non admin."""
|
||||
|
||||
setattr(func, "IS_NON_ADMIN", True)
|
||||
return func
|
||||
Reference in new issue
Block a user