-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from sennetconsortium/libpitt/116-board-eps
Libpitt/116 board eps
- Loading branch information
Showing
8 changed files
with
313 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from flask import Blueprint, jsonify, request, Response, current_app, abort, json | ||
import urllib.request | ||
from hubmap_commons import file_helper as commons_file_helper | ||
|
||
def get_globus_url(data_access_level, group_name, uuid): | ||
globus_server_uuid = None | ||
dir_path = " " | ||
# public access | ||
if data_access_level == "public": | ||
globus_server_uuid = current_app.config['GLOBUS_PUBLIC_ENDPOINT_UUID'] | ||
access_dir = commons_file_helper.ensureTrailingSlashURL(current_app.config['ACCESS_LEVEL_PUBLIC']) | ||
dir_path = dir_path + access_dir + "/" | ||
# consortium access | ||
elif data_access_level == 'consortium': | ||
globus_server_uuid = current_app.config['GLOBUS_CONSORTIUM_ENDPOINT_UUID'] | ||
access_dir = commons_file_helper.ensureTrailingSlashURL(current_app.config['ACCESS_LEVEL_CONSORTIUM']) | ||
dir_path = dir_path + access_dir + group_name + "/" | ||
# protected access | ||
elif data_access_level == 'protected': | ||
globus_server_uuid = current_app.config['GLOBUS_PROTECTED_ENDPOINT_UUID'] | ||
access_dir = commons_file_helper.ensureTrailingSlashURL(current_app.config['ACCESS_LEVEL_PROTECTED']) | ||
dir_path = dir_path + access_dir + group_name + "/" | ||
|
||
if globus_server_uuid is not None: | ||
dir_path = dir_path + uuid + "/" | ||
dir_path = urllib.parse.quote(dir_path, safe='') | ||
|
||
# https://current_app.globus.org/file-manager?origin_id=28bb03c-a87d-4dd7-a661-7ea2fb6ea631&origin_path=2%FIEC%20Testing%20Group%20F03584b3d0f8b46de1b29f04be1568779%2F | ||
globus_url = commons_file_helper.ensureTrailingSlash(current_app.config[ | ||
'GLOBUS_APP_BASE_URL']) + "file-manager?origin_id=" + globus_server_uuid + "&origin_path=" + dir_path | ||
|
||
else: | ||
globus_url = "" | ||
if uuid is None: | ||
globus_url = "" | ||
return globus_url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from neo4j import Driver | ||
|
||
neo4j_driver_instance = None | ||
|
||
|
||
class Neo4jHelper: | ||
@staticmethod | ||
def set_instance(neo4j): | ||
global neo4j_driver_instance | ||
neo4j_driver_instance = neo4j | ||
|
||
@staticmethod | ||
def get_instance(): | ||
global neo4j_driver_instance | ||
return neo4j_driver_instance | ||
|
||
@staticmethod | ||
def close(): | ||
# Specify as module-scope variable | ||
global neo4j_driver_instance | ||
|
||
if isinstance(neo4j_driver_instance, Driver): | ||
neo4j_driver_instance.close() | ||
neo4j_driver_instance = None | ||
else: | ||
raise TypeError("The private module variable '_driver' is not a neo4j.Driver object") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.