diff options
author | zsloan | 2021-10-22 18:48:02 +0000 |
---|---|---|
committer | zsloan | 2021-10-22 18:53:24 +0000 |
commit | a9ca9b0da80feaa5318343dbb7b814c78b5f41f7 (patch) | |
tree | 9f4f2e857df80db39c1b2f862b1093299d0e0331 | |
parent | a05d0e4eb9412d9495a0f96980df27acb1526a03 (diff) | |
download | genenetwork2-a9ca9b0da80feaa5318343dbb7b814c78b5f41f7.tar.gz |
Replace hardcoded GN proxy URL in decorators.py with one pulled from settings
-rw-r--r-- | wqflask/wqflask/decorators.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/wqflask/wqflask/decorators.py b/wqflask/wqflask/decorators.py index 54aa6795..c19e1aef 100644 --- a/wqflask/wqflask/decorators.py +++ b/wqflask/wqflask/decorators.py @@ -3,6 +3,7 @@ from flask import g from typing import Dict from functools import wraps from utility.hmac import hmac_creation +from utility.tools import GN_PROXY_URL import json import requests @@ -25,11 +26,11 @@ def edit_access_required(f): _user_id = g.user_session.record.get(b"user_id", "").decode("utf-8") response = json.loads( - requests.get("http://localhost:8080/" - "available?resource=" - f"{resource_id}&user={_user_id}").content) + requests.get(GN_PROXY_URL + "available?resource=" + f"{resource_id}&user={_user_id}").content) except: response = {} + if "edit" not in response.get("data", []): return "You need to be admin", 401 return f(*args, **kwargs) |