aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/authentication_tools.py
diff options
context:
space:
mode:
authorzsloan2021-10-18 17:50:26 +0000
committerzsloan2021-10-18 17:50:26 +0000
commite36eaf0003a598bc5aa688803dd1b36c24a4c051 (patch)
treea59b7dadf02241575eb0774f97c6048e2425c053 /wqflask/utility/authentication_tools.py
parentbd421438f1f0b4de913fa40cd49cfcda27e6b16f (diff)
parent04f3d13aceeaec2e52b94037d59f08ed6dc6a8bb (diff)
downloadgenenetwork2-e36eaf0003a598bc5aa688803dd1b36c24a4c051.tar.gz
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into feature/remove_trait_creation_from_search
Diffstat (limited to 'wqflask/utility/authentication_tools.py')
-rw-r--r--wqflask/utility/authentication_tools.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/wqflask/utility/authentication_tools.py b/wqflask/utility/authentication_tools.py
index 786475a8..6802d689 100644
--- a/wqflask/utility/authentication_tools.py
+++ b/wqflask/utility/authentication_tools.py
@@ -31,7 +31,7 @@ def check_resource_availability(dataset, trait_id=None):
# ZS: Check if super-user - we should probably come up with some
# way to integrate this into the proxy
- if str.encode(g.user_session.user_id) in Redis.smembers("super_users"):
+ if g.user_session.user_id in Redis.smembers("super_users"):
return webqtlConfig.SUPER_PRIVILEGES
response = None
@@ -132,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 str.encode(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)