Skip to content
Snippets Groups Projects
Commit a538d2fa authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

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

parent a7554083
No related branches found
No related tags found
2 merge requests!1340.8.2 release,!133Bugfixes markus
Pipeline #78637 passed
......@@ -167,6 +167,8 @@ class ArchiveDownloadResource(Resource):
common.logger.error('upload files do not exist', upload_id=upload_id)
continue
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(
archive[calc_id].to_dict(),
......@@ -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)
else:
access = 'public'
......@@ -330,8 +334,8 @@ class ArchiveQueryResource(Resource):
# We simply skip this entry
pass
except Restricted:
# TODO in reality this should not happen
pass
# 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:
try:
calc = processing.Calc.get(calc_id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment