Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
a538d2fa
Commit
a538d2fa
authored
Jul 15, 2020
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/app/api/archive.py
View file @
a538d2fa
...
...
@@ -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
...
...
nomad/app/api/auth.py
View file @
a538d2fa
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment