Skip to content

Commit

Permalink
Add jasmin_authenticator tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nf679 committed Jan 14, 2025
1 parent 6a5732b commit 827c40b
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 87 deletions.
7 changes: 4 additions & 3 deletions nlds/authenticators/jasmin_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ def authenticate_user_group_role(self, oauth_token: str, user: str, group: str):
response_json = json.loads(response.text)
# is_manager is False by default and only changes if user has a manager or deputy role.
is_manager = False
for role in response_json:
if role["role"]["name"] in ["MANAGER", "DEPUTY"]:
for role in response_json['group_workspaces']:
if role in ["MANAGER", "DEPUTY"]:
is_manager = True
return is_manager
except KeyError:
Expand Down Expand Up @@ -273,7 +273,7 @@ def user_has_get_file_permission(session,

return permitted

@staticmethod

def user_has_delete_from_holding_permission(self, user: str,
group: str,
holding: Holding) -> bool:
Expand Down Expand Up @@ -302,6 +302,7 @@ def get_service_information(self, service_name: str):
}
# Contact the user_services_url to get the information about the services
url = format_url([config["project_services_url"]], {"name": service_name})
print(url)
try:
response = requests.get(
url,
Expand Down
Loading

0 comments on commit 827c40b

Please sign in to comment.