Skip to content

Commit 6af84aa

Browse files
authored
Merge pull request #365 from CanDIG/daisieh/list-objects
DIG-2062: list objects should check authorization
2 parents 4d18d25 + 1507aaa commit 6af84aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

htsget_server/drs_operations.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def get_object_for_drs_uri(drs_uri):
7575

7676

7777
def list_objects(program_id=None, submitter_sample_id=None):
78+
if program_id is not None:
79+
if not authz.is_program_authorized(connexion.request, program_id):
80+
return {"message": f"Not authorized to list objects for program {program_id}"}, 403
81+
else:
82+
if not authz.has_full_authz(connexion.request):
83+
return {"message": f"Not authorized to list all objects"}, 403
7884
return database.list_drs_objects(program_id=program_id, submitter_sample_id=submitter_sample_id), 200
7985

8086

0 commit comments

Comments
 (0)