aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2022-05-20 11:27:17 +0300
committerBonfaceKilz2022-05-27 15:17:52 +0300
commit77f12fb59c4277e2bd51f8dba78518172bca1735 (patch)
tree13d93a12066051dcfb608c2f219b03ab6135cfe0 /wqflask
parent4dc286cae2d453db3e99ef06eb27343a2f6e0c07 (diff)
downloadgenenetwork2-77f12fb59c4277e2bd51f8dba78518172bca1735.tar.gz
Replace "_get_author" with "gn3.authentication.get_user_info_by_key"
* wqflask/wqflask/metadata_edits.py (_get_author): Delete function. (show_case_attribute_columns): Use "get_user_info_by_key".
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/metadata_edits.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py
index dcadcc99..a13cadf8 100644
--- a/wqflask/wqflask/metadata_edits.py
+++ b/wqflask/wqflask/metadata_edits.py
@@ -26,6 +26,7 @@ from wqflask.decorators import login_required
from gn3.authentication import AdminRole
from gn3.authentication import get_highest_user_access_role
+from gn3.authentication import get_user_info_by_key
from gn3.csvcmp import create_dirs_if_not_exists
from gn3.csvcmp import csv_diff
from gn3.csvcmp import extract_invalid_csv_headers
@@ -51,14 +52,6 @@ from gn3.db.sample_data import get_case_attributes
metadata_edit = Blueprint("metadata_edit", __name__)
-def _get_author(author: str) -> str:
- redis_conn = redis.from_url(
- current_app.config["REDIS_URL"], decode_responses=True
- )
- return json.loads(redis_conn.hget("users", author)).get(
- "full_name", author)
-
-
def _get_diffs(
diff_dir: str, user_id: str, redis_conn: redis.Redis, gn_proxy_url: str
):
@@ -718,7 +711,13 @@ def show_case_attribute_columns():
if diff_data:
for id_, author, diff in diff_data:
diff = json.loads(diff)
- author = _get_author(author)
+ author = get_user_info_by_key(
+ key="user_id",
+ value=author,
+ conn=redis.from_url(
+ current_app.config["REDIS_URL"], decode_responses=True
+ )
+ ).get("full_name")
if (m_ := diff.get("Modification")):
m_["author"] = author
m_["id"] = id_