diff --git a/src/instance/app.cfg.example b/src/instance/app.cfg.example index 37006af1..13c96d4b 100644 --- a/src/instance/app.cfg.example +++ b/src/instance/app.cfg.example @@ -35,8 +35,9 @@ 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 COOKIE_DOMAIN = '.sennetconsortium.org' 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 diff --git a/src/routes/auth/__init__.py b/src/routes/auth/__init__.py index 84188faf..64ab40b3 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", ) 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..d9236a4f 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-edit") +def privs_has_senotype_edit(): + groups_token: str = get_groups_token() + auth_helper_instance: AuthHelper = AuthHelper.instance() + 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_edit = True + + headers: dict = {"Content-Type": "application/json"} + return make_response(jsonify({"has_senotype_edit": has_senotype_edit}), 200, headers) + + + @privs_blueprint.route("/privs/has-data-admin") def privs_has_data_admin_privs(): groups_token: str = get_groups_token()