Commit a538d2fa authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed share_with for archive/raw queries/downloads. #314

parent a7554083
Pipeline #78637 passed with stages
in 20 minutes and 35 seconds
......@@ -167,6 +167,8 @@ class ArchiveDownloadResource(Resource):
common.logger.error('upload files do not exist', upload_id=upload_id)
upload_files._is_authorized = create_authorization_predicate(
upload_id=upload_id, calc_id=calc_id)
with upload_files.read_archive(calc_id) as archive:
f = BytesIO(orjson.dumps(
......@@ -311,6 +313,8 @@ class ArchiveQueryResource(Resource):
if with_embargo:
access = 'restricted'
upload_files._is_authorized = create_authorization_predicate(
upload_id=upload_id, calc_id=calc_id)
access = 'public'
......@@ -330,8 +334,8 @@ class ArchiveQueryResource(Resource):
# We simply skip this entry
except Restricted:
# TODO in reality this should not happen
# this should not happen
common.logger.error('supposedly unreachable code', upload_id=upload_id, calc_id=calc_id)
except Exception as e:
if raise_errors:
raise e
......@@ -320,7 +320,6 @@ def create_authorization_predicate(upload_id, calc_id=None):
if g.user.user_id == upload.user_id:
return True
# TODO I doubt if shared_with is actually working
if calc_id is not None:
calc = processing.Calc.get(calc_id)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment