Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
6196ef30
Commit
6196ef30
authored
1 year ago
by
Erwan Rouchet
Committed by
Bastien Abadie
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow access to the DataFile S3 URL to IIIF processes
parent
9c542aba
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2067
Allow access to the DataFile S3 URL to IIIF processes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex/process/serializers/files.py
+2
-2
2 additions, 2 deletions
arkindex/process/serializers/files.py
arkindex/process/tests/test_datafile_api.py
+2
-2
2 additions, 2 deletions
arkindex/process/tests/test_datafile_api.py
with
4 additions
and
4 deletions
arkindex/process/serializers/files.py
+
2
−
2
View file @
6196ef30
...
...
@@ -41,11 +41,11 @@ class DataFileSerializer(serializers.ModelSerializer):
def
get_s3_url
(
self
,
obj
):
if
'
request
'
not
in
self
.
context
:
return
# Only allow the S3 URL for ponos tasks of Files processes or admins
# Only allow the S3 URL for ponos tasks of Files
or IIIF
processes or admins
request
=
self
.
context
[
'
request
'
]
if
is_admin_or_ponos_task
(
request
):
request_process
=
get_process_from_task_auth
(
request
)
if
not
request_process
or
request_process
.
mode
==
ProcessMode
.
Files
:
if
not
request_process
or
request_process
.
mode
in
(
ProcessMode
.
Files
,
ProcessMode
.
IIIF
)
:
return
obj
.
s3_url
...
...
This diff is collapsed.
Click to expand it.
arkindex/process/tests/test_datafile_api.py
+
2
−
2
View file @
6196ef30
...
...
@@ -157,7 +157,7 @@ class TestDataFileApi(FixtureAPITestCase):
def
test_retrieve_datafile_s3_url_task_process_mode
(
self
,
gen_url_mock
):
"""
Ponos task authentication allows access to the S3 URL, only if the task
'
s
parent process
is of
Files
ProcessM
ode.
parent process
has a
Files
or IIIF m
ode.
"""
user
=
User
.
objects
.
create
(
email
=
'
user2@test.test
'
,
display_name
=
'
User 2
'
,
verified_email
=
True
)
gen_url_mock
.
return_value
=
'
http://somewhere
'
...
...
@@ -170,7 +170,7 @@ class TestDataFileApi(FixtureAPITestCase):
with
self
.
settings
(
IMPORTS_WORKER_VERSION
=
str
(
self
.
import_worker_version
.
id
)):
process
.
start
()
cases
=
[
(
process_mode
,
'
http://somewhere
'
if
process_mode
==
ProcessMode
.
Files
else
None
)
(
process_mode
,
'
http://somewhere
'
if
process_mode
in
(
ProcessMode
.
Files
,
ProcessMode
.
IIIF
)
else
None
)
for
process_mode
in
ProcessMode
]
for
process_mode
,
s3_url
in
cases
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment