about summary refs log tree commit diff
diff options
context:
space:
mode:
authorzsloan2020-07-29 18:50:08 -0500
committerzsloan2020-07-29 18:50:08 -0500
commit317d7a78930ecf4be8ec80bd688c14baa8852f04 (patch)
treef099f478f21ed93791bf4840199d5c6d39438ccb
parent06a3758eedbc6df53caab3b1ef320df781b71e83 (diff)
downloadgenenetwork2-317d7a78930ecf4be8ec80bd688c14baa8852f04.tar.gz
Fixed error that occured for new resources in check_admin
* wqflask/utility/authentication_tools.py: the code forgot to get
resource_info when a resource wasn't in Redis yet, causing an error when
it was referenced, so I added a line getting the resource info (and also
a couple comments for other lines related to authentication)
-rw-r--r--wqflask/utility/authentication_tools.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/wqflask/utility/authentication_tools.py b/wqflask/utility/authentication_tools.py
index 9a2a5ccd..ece7022c 100644
--- a/wqflask/utility/authentication_tools.py
+++ b/wqflask/utility/authentication_tools.py
@@ -24,9 +24,9 @@ def check_resource_availability(dataset, trait_id=None):
 
     resource_id = get_resource_id(dataset, trait_id)
 
-    if resource_id:
+    if resource_id: #ZS: This should never be false, but it's technically possible if a non-Temp dataset somehow had a type other than Publish/ProbeSet/Geno
         resource_info = get_resource_info(resource_id)
-        if not resource_info:
+        if not resource_info: #ZS: If resource isn't already in redis, add it with default privileges
             resource_info = add_new_resource(dataset, trait_id)
 
     #ZS: Check if super-user - we should probably come up with some way to integrate this into the proxy
@@ -84,7 +84,7 @@ def check_admin(resource_id=None):
     try:
         response = json.loads(requests.get(the_url).content)['admin']
     except:
-        logger.debug(resource_info)
+        resource_info = get_resource_info(resource_id)
         response = resource_info['default_mask']['admin']
 
     if 'edit-admins' in response: