summaryrefslogtreecommitdiff
path: root/sw/users.py
diff options
context:
space:
mode:
authorTom Harley2021-07-07 15:41:42 +0000
committerTom Harley2021-07-07 15:41:42 +0000
commit6e58d1e712068de46f68a1188328d68273605f5b (patch)
tree9df3ed956ecc6fba0aac1b2f121188ef7b5b2811 /sw/users.py
parentBegin work on adding user interaction (diff)
downloadswap-6e58d1e712068de46f68a1188328d68273605f5b.tar.gz
swap-6e58d1e712068de46f68a1188328d68273605f5b.zip

Add testing for authorisation decorators

Test addition commits always look big lmao

As mentioned in the previous commit, this commit adds a check for the correct user when accessing someone’s /inbox.

Diffstat (limited to 'sw/users.py')
-rw-r--r--sw/users.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sw/users.py b/sw/users.py
index 724965e..dffae93 100644
--- a/sw/users.py
+++ b/sw/users.py
@@ -1,9 +1,10 @@
-from flask import Blueprint, jsonify, url_for, request
+from flask import Blueprint, jsonify, url_for, request, abort
import json
from sw.db import get_db
from sw.time import now
+from sw.auth import specific_user_required
bp = Blueprint("users", __name__, url_prefix="/u")
@@ -36,6 +37,7 @@ def get_user_info(username):
@bp.route("/<username>/inbox")
+@specific_user_required
def get_user_inbox(username):
db = get_db()