Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions staging_service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ async def add_acl_concierge(request: web.Request):
return web.json_response(result)


@routes.get("/acl-status")
async def add_acl(request: web.Request):
username = await authorize_request(request)
user_dir = Path.validate_path(username).full_path
result = AclManager().acl_status(user_dir)
return web.json_response(result)


@routes.get("/add-acl")
async def add_acl(request: web.Request):
username = await authorize_request(request)
Expand Down
19 changes: 18 additions & 1 deletion staging_service/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def validate_path(username: str, path: str = ""):

@staticmethod
def from_full_path(full_path: str):
user_path = full_path[len(Path._DATA_DIR) :]
user_path = full_path[len(Path._DATA_DIR):]
if user_path.startswith("/"):
user_path = user_path[1:]
metadata_path = os.path.join(Path._META_DIR, user_path)
Expand Down Expand Up @@ -270,6 +270,23 @@ def add_acl_concierge(self, shared_directory: str, concierge_path: str):

return self._add_acl(user_identity_id, concierge_path)

def acl_status(self, shared_directory: str):
"""
Inspect ACLS for user and provide instructions
:param shared_directory: Directory to get globus ID from
:return: Result of status check
"""
user_identity_id = self._get_globus_identity(shared_directory)
base_name = "/{}/".format(shared_directory.split("/")[-2])
remove_acl = "https://kbase.us/services/staging_service/remove-acl"
add_acl = "https://kbase.us/services/staging_service/add-acl"
return {"base_name": base_name, "user_identity_id": user_identity_id,
"globus_info": f"You must be logged in with {user_identity_id} " +
"in globus to see your directory",
"troubleshooting": f"To reset your globus permissions please visit " +
f"{remove_acl} and then visit {add_acl} "
}

def add_acl(self, shared_directory: str):
"""
Add ACL to the globus share via the globus API
Expand Down