summaryrefslogtreecommitdiff
path: root/server/szurubooru/func/auth.py
diff options
context:
space:
mode:
authorrr- <rr-@sakuya.pl>2016-05-08 16:59:25 +0200
committerrr- <rr-@sakuya.pl>2016-05-08 16:59:25 +0200
commit198cb0af3e18bb8b526199d309d50df764e36552 (patch)
treea7127d07d206ef8aa9ea5fc3d975fc4f8094c31d /server/szurubooru/func/auth.py
parent58964bcdc9cfeccd72a017fdbd2f4ffc8ba7b6f3 (diff)
server/users: hardcode available ranks
Diffstat (limited to 'server/szurubooru/func/auth.py')
-rw-r--r--server/szurubooru/func/auth.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/server/szurubooru/func/auth.py b/server/szurubooru/func/auth.py
index 8a5edcb..9134a6c 100644
--- a/server/szurubooru/func/auth.py
+++ b/server/szurubooru/func/auth.py
@@ -1,7 +1,6 @@
import hashlib
import random
-from szurubooru import config
-from szurubooru import errors
+from szurubooru import config, db, errors
def get_password_hash(salt, password):
''' Retrieve new-style password hash. '''
@@ -37,11 +36,10 @@ def is_valid_password(user, password):
return valid_hash in possible_hashes
def has_privilege(user, privilege_name):
- all_ranks = config.config['ranks']
assert privilege_name in config.config['privileges']
- assert user.rank in all_ranks
+ assert user.rank in db.User.ALL_RANKS
minimal_rank = config.config['privileges'][privilege_name]
- good_ranks = all_ranks[all_ranks.index(minimal_rank):]
+ good_ranks = db.User.ALL_RANKS[db.User.ALL_RANKS.index(minimal_rank):]
return user.rank in good_ranks
def verify_privilege(user, privilege_name):