aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/authentication_tools.py
diff options
context:
space:
mode:
authorBonfaceKilz2020-09-17 17:16:28 +0300
committerBonfaceKilz2020-09-17 17:16:28 +0300
commitf4a8789a5f28e1527d4c801b40176f47aa44146c (patch)
tree94ef64cd8533d8bac7eacf591c0b92e3e35f68e9 /wqflask/utility/authentication_tools.py
parent81f6c22573db69e8ab0d2b831fc659147a839bbd (diff)
downloadgenenetwork2-f4a8789a5f28e1527d4c801b40176f47aa44146c.tar.gz
Apply pep8
* wqflask/base/trait.py: Apply pep8. * wqflask/utility/authentication_tools.py: Ditto.
Diffstat (limited to 'wqflask/utility/authentication_tools.py')
-rw-r--r--wqflask/utility/authentication_tools.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/wqflask/utility/authentication_tools.py b/wqflask/utility/authentication_tools.py
index 390ad75a..ce0c0749 100644
--- a/wqflask/utility/authentication_tools.py
+++ b/wqflask/utility/authentication_tools.py
@@ -1,30 +1,37 @@
import json
import requests
-from base import data_set, webqtlConfig
-
-from utility import hmac
-from utility.redis_tools import get_redis_conn, get_resource_info, get_resource_id, add_resource
-Redis = get_redis_conn()
+from flask import g
+from base import webqtlConfig
-logger = logging.getLogger(__name__)
+from utility.redis_tools import (get_redis_conn,
+ get_resource_info,
+ get_resource_id,
+ 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":
return webqtlConfig.DEFAULT_PRIVILEGES
resource_id = get_resource_id(dataset, trait_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
+ # 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
+ if resource_id:
resource_info = get_resource_info(resource_id)
- if not resource_info: # ZS: If resource isn't already in redis, add it with default privileges
+
+ # ZS: If resource isn't already in redis, add it with default
+ # privileges
+ if not resource_info:
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
+ # ZS: Check if super-user - we should probably come up with some
+ # way to integrate this into the proxy
if g.user_session.user_id in Redis.smembers("super_users"):
return webqtlConfig.SUPER_PRIVILEGES
@@ -76,8 +83,9 @@ def add_new_resource(dataset, trait_id=None):
def get_group_code(dataset):
- results = g.db.execute("SELECT InbredSetCode from InbredSet where Name='{}'".format(
- dataset.group.name)).fetchone()
+ results = g.db.execute(
+ "SELECT InbredSetCode from InbredSet where Name='{}'".format(
+ dataset.group.name)).fetchone()
if results[0]:
return results[0]
else: