summaryrefslogtreecommitdiffstats
path: root/nfsw/auth.py
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-09-21 11:48:18 -0400
committerrsiddharth <s@ricketyspace.net>2019-09-21 11:48:18 -0400
commitf72e31fa757b1e7d99c0602b7f9e5eeccb9ec33d (patch)
tree80c342a7044f3d29ea852d9eca4352fab39f3fbb /nfsw/auth.py
parent54948587f10a53b672af97a14f1f81891a2821d7 (diff)
nfsw/auth.py: Add login_required_ajax.
Diffstat (limited to 'nfsw/auth.py')
-rw-r--r--nfsw/auth.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/nfsw/auth.py b/nfsw/auth.py
index 697f89e..cc7359c 100644
--- a/nfsw/auth.py
+++ b/nfsw/auth.py
@@ -27,6 +27,19 @@ def login_required(view):
return wrapped_view
+def login_required_ajax(view):
+ @functools.wraps(view)
+ def wrapped_view(**kwargs):
+ if g.user is None:
+ return {
+ 'msg': 'Permission denied'
+ }, 403
+
+ return view(**kwargs)
+
+ return wrapped_view
+
+
def anon_only(view):
@functools.wraps(view)
def wrapped_view(**kwargs):