Deprecates storing user type in session (#1323)

* Deprecates storing session["type"] as a means of referring to the user's current level. Instead you should refer to the database.
* Adds `CTFd.utils.user.get_current_user_type()` to get the current user's type or return None if the user is unauthed. 
* Closes #1279
This commit is contained in:
Kevin Chung
2020-04-15 03:04:18 -04:00
committed by GitHub
parent c21707c14d
commit 578b5261b2
9 changed files with 24 additions and 18 deletions

View File

@@ -150,7 +150,6 @@ def register_user(
with client.session_transaction() as sess:
assert sess["id"]
assert sess["name"] == name
assert sess["type"]
assert sess["email"]
assert sess["nonce"]
@@ -178,7 +177,6 @@ def login_as_user(app, name="user", password="password", raise_for_error=True):
with client.session_transaction() as sess:
assert sess["id"]
assert sess["name"]
assert sess["type"]
assert sess["email"]
assert sess["nonce"]
return client
@@ -237,7 +235,6 @@ def login_with_mlc(
with client.session_transaction() as sess:
assert sess["id"]
assert sess["name"]
assert sess["type"]
assert sess["email"]
assert sess["nonce"]
return client