From 016f7eef46377228e52ec1474aac628206e9e801 Mon Sep 17 00:00:00 2001 From: maxsibilla Date: Wed, 15 Apr 2026 14:07:42 -0400 Subject: [PATCH 1/6] Adding new privs method to check for senotype edit --- src/instance/app.cfg.example | 1 + src/routes/metadata/__init__.py | 2 +- src/routes/privs/__init__.py | 20 +++++++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/instance/app.cfg.example b/src/instance/app.cfg.example index 37006af1..9579a8f0 100644 --- a/src/instance/app.cfg.example +++ b/src/instance/app.cfg.example @@ -37,6 +37,7 @@ DATA_INGEST_BOARD_NAME = ‘Data Ingest Board - DEV’ SENOTYPE_SEARCH_URI = 'http://localhost:3002/' SENOTYPE_SEARCH_NAME = 'SenNet Senotype Search - DEV' +SENOTYPE_GROUP_UUID = 'c43c14da-0b51-11f1-a6c4-0e71192eda6f' #Sets the domain for the cookie set upon login to the portal. Use `localhost` for local development COOKIE_DOMAIN = '.sennetconsortium.org' diff --git a/src/routes/metadata/__init__.py b/src/routes/metadata/__init__.py index 757a9876..8680f581 100644 --- a/src/routes/metadata/__init__.py +++ b/src/routes/metadata/__init__.py @@ -223,7 +223,7 @@ def get_all_data_provider_groups(token: str, user: User): def get_provenance_metadata(ds_uuid: str): try: token = get_token() - entity = get_entity(entity_id=ds_uuid, token=token) + entity = get_entity(entity_id=ds_uuid, token=None) e = Ontology.ops().entities() allowed_entity_types = [e.DATASET, "Publication"] diff --git a/src/routes/privs/__init__.py b/src/routes/privs/__init__.py index 16c35fbf..9d153422 100644 --- a/src/routes/privs/__init__.py +++ b/src/routes/privs/__init__.py @@ -1,7 +1,7 @@ import logging from typing import List -from flask import Blueprint, Response, jsonify, make_response, request +from flask import Blueprint, Response, jsonify, make_response, request, current_app from hubmap_commons.exceptions import HTTPException from hubmap_commons.hm_auth import AuthHelper @@ -55,6 +55,24 @@ def privs_get_user_write_groups(): return make_response(jsonify({"user_write_groups": user_write_groups}), 200, headers) +@privs_blueprint.route("/privs/has-senotype-write") +def privs_has_senotype_write(): + groups_token: str = get_groups_token() + auth_helper_instance: AuthHelper = AuthHelper.instance() + has_senotype_write = False + + user_info = auth_helper_instance.getUserInfo(groups_token, getGroups=True) + if isinstance(user_info, Response): + return user_info + + if current_app.config["SENOTYPE_GROUP_UUID"] in user_info['hmgroupids']: + has_senotype_write = True + + headers: dict = {"Content-Type": "application/json"} + return make_response(jsonify({"has-senotype-write": has_senotype_write}), 200, headers) + + + @privs_blueprint.route("/privs/has-data-admin") def privs_has_data_admin_privs(): groups_token: str = get_groups_token() From b7c363f1190d09528aec3f90ee363b44f49d0384 Mon Sep 17 00:00:00 2001 From: maxsibilla Date: Wed, 15 Apr 2026 15:06:08 -0400 Subject: [PATCH 2/6] Modifying response key --- src/routes/privs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/privs/__init__.py b/src/routes/privs/__init__.py index 9d153422..fe060851 100644 --- a/src/routes/privs/__init__.py +++ b/src/routes/privs/__init__.py @@ -69,7 +69,7 @@ def privs_has_senotype_write(): has_senotype_write = True headers: dict = {"Content-Type": "application/json"} - return make_response(jsonify({"has-senotype-write": has_senotype_write}), 200, headers) + return make_response(jsonify({"has_senotype_write": has_senotype_write}), 200, headers) From 42e5c916d5cd12b4d21d072bb0672c68896c7fbe Mon Sep 17 00:00:00 2001 From: maxsibilla Date: Thu, 16 Apr 2026 09:21:49 -0400 Subject: [PATCH 3/6] Updating privs endpoint --- src/routes/privs/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/routes/privs/__init__.py b/src/routes/privs/__init__.py index fe060851..d9236a4f 100644 --- a/src/routes/privs/__init__.py +++ b/src/routes/privs/__init__.py @@ -55,21 +55,21 @@ def privs_get_user_write_groups(): return make_response(jsonify({"user_write_groups": user_write_groups}), 200, headers) -@privs_blueprint.route("/privs/has-senotype-write") -def privs_has_senotype_write(): +@privs_blueprint.route("/privs/has-senotype-edit") +def privs_has_senotype_edit(): groups_token: str = get_groups_token() auth_helper_instance: AuthHelper = AuthHelper.instance() - has_senotype_write = False + has_senotype_edit = False user_info = auth_helper_instance.getUserInfo(groups_token, getGroups=True) if isinstance(user_info, Response): return user_info if current_app.config["SENOTYPE_GROUP_UUID"] in user_info['hmgroupids']: - has_senotype_write = True + has_senotype_edit = True headers: dict = {"Content-Type": "application/json"} - return make_response(jsonify({"has_senotype_write": has_senotype_write}), 200, headers) + return make_response(jsonify({"has_senotype_edit": has_senotype_edit}), 200, headers) From 5ec46191ab35258f1f017fe858b8f6690eefe45d Mon Sep 17 00:00:00 2001 From: maxsibilla Date: Thu, 16 Apr 2026 10:00:05 -0400 Subject: [PATCH 4/6] Bumping common version --- src/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requirements.txt b/src/requirements.txt index 44950c40..c645adc0 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -15,7 +15,7 @@ requests==2.33.0 # Use the branch name of commons from github for testing new changes made in commons from different branch # Default is main branch specified in docker-compose.development.yml if not set # git+https://github.com/hubmapconsortium/commons.git@${COMMONS_BRANCH}#egg=hubmap-commons -hubmap-commons==2.1.23 +hubmap-commons==2.1.24 atlas-consortia-commons==1.1.5 # For assay type rules From db13e80da10955de17718fbf983060d578c1bf06 Mon Sep 17 00:00:00 2001 From: maxsibilla Date: Fri, 17 Apr 2026 13:44:11 -0400 Subject: [PATCH 5/6] Updating senotype search to senotype library --- src/instance/app.cfg.example | 4 ++-- src/routes/auth/__init__.py | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/instance/app.cfg.example b/src/instance/app.cfg.example index 9579a8f0..13c96d4b 100644 --- a/src/instance/app.cfg.example +++ b/src/instance/app.cfg.example @@ -35,8 +35,8 @@ GLOBUS_CLIENT_APP_URI = 'https://data.dev.sennetconsortium.org/' DATA_INGEST_BOARD_APP_URI = 'http://localhost:3001/' DATA_INGEST_BOARD_NAME = ‘Data Ingest Board - DEV’ -SENOTYPE_SEARCH_URI = 'http://localhost:3002/' -SENOTYPE_SEARCH_NAME = 'SenNet Senotype Search - DEV' +SENOTYPE_LIBRARY_URI = 'https://senlib.dev.sennetconsortium.org/' +SENOTYPE_LIBRARY_NAME = 'SenNet Senotype Library - DEV' SENOTYPE_GROUP_UUID = 'c43c14da-0b51-11f1-a6c4-0e71192eda6f' #Sets the domain for the cookie set upon login to the portal. Use `localhost` for local development diff --git a/src/routes/auth/__init__.py b/src/routes/auth/__init__.py index 84188faf..8e27ffba 100644 --- a/src/routes/auth/__init__.py +++ b/src/routes/auth/__init__.py @@ -43,12 +43,12 @@ def data_ingest_login(): redirect_failure_uri="/data-ingest-board-logout", ) -@auth_blueprint.route("/senotype-search-login") -def senotype_search_login(): +@auth_blueprint.route("/senotype-library-login") +def senotype_library_login(): return _login( - redirect_uri=current_app.config["SENOTYPE_SEARCH_URI"], - key="senotype_search_tokens", - redirect_failure_uri="/senotype-serach-logout", + redirect_uri=current_app.config["senotype_library_URI"], + key="senotype_library_tokens", + redirect_failure_uri="/senotype-library-logout", ) @auth_blueprint.route("/logout") @@ -63,14 +63,14 @@ def logout(): def data_ingest_logout(): return _logout( redirect_uri=current_app.config["DATA_INGEST_BOARD_APP_URI"], - app_name=current_app.config["SENOTYPE_SEARCH_NAME"], - key="senotype_search_tokens", + app_name=current_app.config["SENOTYPE_LIBRARY_NAME"], + key="senotype_library_tokens", ) -@auth_blueprint.route("/senotype-search-logout") -def senotype_search_logout(): +@auth_blueprint.route("/senotype-library-logout") +def senotype_library_logout(): return _logout( - redirect_uri=current_app.config["SENOTYPE_SEARCH_URI"], + redirect_uri=current_app.config["SENOTYPE_LIBRARY_URI"], app_name=current_app.config["DATA_INGEST_BOARD_NAME"], key="ingest_board_tokens", ) From 11fcf885691b408462ee76588b097fde778aa8f5 Mon Sep 17 00:00:00 2001 From: maxsibilla Date: Fri, 17 Apr 2026 13:51:42 -0400 Subject: [PATCH 6/6] Correcting config usage --- src/routes/auth/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/auth/__init__.py b/src/routes/auth/__init__.py index 8e27ffba..64ab40b3 100644 --- a/src/routes/auth/__init__.py +++ b/src/routes/auth/__init__.py @@ -46,7 +46,7 @@ def data_ingest_login(): @auth_blueprint.route("/senotype-library-login") def senotype_library_login(): return _login( - redirect_uri=current_app.config["senotype_library_URI"], + redirect_uri=current_app.config["SENOTYPE_LIBRARY_URI"], key="senotype_library_tokens", redirect_failure_uri="/senotype-library-logout", )