Skip to content

Commit

Permalink
fix a couple of bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
daisieh committed Dec 5, 2024
1 parent 9be82b4 commit cc8fb93
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions htsget_server/authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def is_authed(id_, request):
def get_authorized_programs(request):
req = AuthzRequest(request.headers, request.method, request.url.path)
if has_full_authz(req):
return map(lambda x: x['id'], database.list_programs())
return list(map(lambda x: x['id'], database.list_programs()))
if is_testing(req):
return ["test-htsget"]
try:
Expand Down Expand Up @@ -82,7 +82,7 @@ def has_full_authz(request):
return True
if "Authorization" in request.headers:
try:
return authx.auth.has_full_authz(AuthzRequest(request.headers, request.method, request.url.path))
return authx.auth.is_site_admin(AuthzRequest(request.headers, request.method, request.url.path))
except Exception as e:
logger.warning(f"Couldn't authorize for full access: {type(e)} {str(e)}")
return False
Expand Down
2 changes: 0 additions & 2 deletions htsget_server/drs_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ def list_programs():
if programs is None:
return [], 404
try:
if authz.has_full_authz(connexion.request):
return list(map(lambda x: x['id'], programs)), 200
authorized_programs = authz.get_authorized_programs(connexion.request)
return list(set(map(lambda x: x['id'], programs)).intersection(set(authorized_programs))), 200
except Exception as e:
Expand Down

0 comments on commit cc8fb93

Please sign in to comment.