diff options
author | zsloan | 2021-10-05 16:41:13 -0500 |
---|---|---|
committer | GitHub | 2021-10-05 16:41:13 -0500 |
commit | 70023c835bdeeffc48efafe96626ac5b01b5a6d2 (patch) | |
tree | 5e23e1139d2e01e2ad42969f58d148132db963a7 /wqflask/utility/authentication_tools.py | |
parent | de79d0d5087bf97f59a16327132fd287d57e1c3f (diff) | |
parent | 4c6a7e46dd7afe311c0bed38c4a69ddadf3cb416 (diff) | |
download | genenetwork2-70023c835bdeeffc48efafe96626ac5b01b5a6d2.tar.gz |
Merge branch 'testing' into feature/add_resizeable_columns
Diffstat (limited to 'wqflask/utility/authentication_tools.py')
-rw-r--r-- | wqflask/utility/authentication_tools.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/wqflask/utility/authentication_tools.py b/wqflask/utility/authentication_tools.py index 57dbf8ba..6802d689 100644 --- a/wqflask/utility/authentication_tools.py +++ b/wqflask/utility/authentication_tools.py @@ -11,7 +11,6 @@ from utility.redis_tools import (get_redis_conn, add_resource) Redis = get_redis_conn() - def check_resource_availability(dataset, trait_id=None): # At least for now assume temporary entered traits are accessible if type(dataset) == str or dataset.type == "Temp": @@ -133,12 +132,17 @@ def check_owner_or_admin(dataset=None, trait_id=None, resource_id=None): else: resource_id = get_resource_id(dataset, trait_id) - if g.user_session.user_id in Redis.smembers("super_users"): + try: + user_id = g.user_session.user_id.encode('utf-8') + except: + user_id = g.user_session.user_id + + if user_id in Redis.smembers("super_users"): return "owner" resource_info = get_resource_info(resource_id) if resource_info: - if g.user_session.user_id == resource_info['owner_id']: + if user_id == resource_info['owner_id']: return "owner" else: return check_admin(resource_id) |