Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,9 @@ APP_RDM_IDENTIFIER_SCHEMES_UI = {
RECORDS_RESOURCES_ALLOW_EMPTY_FILES = False
"""Disable empty files for Zenodo."""

RECORDS_RESOURCES_USE_STAGED_TRANSFER = True
"""Use staged transfer for file uploads."""

IIIF_PROXY_CLASS = IIPServerProxy
"""IIIF proxy class for IIIF server."""

Expand Down
12 changes: 11 additions & 1 deletion site/zenodo_rdm/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
SystemProcess,
)
from invenio_records_resources.services.files.generators import IfTransferType
from invenio_records_resources.services.files.transfer import LOCAL_TRANSFER_TYPE
from invenio_records_resources.services.files.transfer import (
LOCAL_STAGED_TRANSFER_TYPE,
LOCAL_TRANSFER_TYPE,
)
from invenio_users_resources.services.permissions import UserManager

from .generators import (
Expand Down Expand Up @@ -114,16 +117,19 @@ class ZenodoRDMRecordPermissionPolicy(RDMRecordPermissionPolicy):
can_draft_set_content_files = [
# review is the same as create_files
IfTransferType(LOCAL_TRANSFER_TYPE, can_review),
IfTransferType(LOCAL_STAGED_TRANSFER_TYPE, can_review),
SystemProcess(),
]
can_draft_get_content_files = [
# preview is same as read_files
IfTransferType(LOCAL_TRANSFER_TYPE, can_draft_read_files),
IfTransferType(LOCAL_STAGED_TRANSFER_TYPE, can_draft_read_files),
SystemProcess(),
]
can_draft_commit_files = [
# review is the same as create_files
IfTransferType(LOCAL_TRANSFER_TYPE, can_review),
IfTransferType(LOCAL_STAGED_TRANSFER_TYPE, can_review),
SystemProcess(),
]
can_draft_update_files = can_review
Expand Down Expand Up @@ -208,6 +214,7 @@ class ZenodoRDMRecordPermissionPolicy(RDMRecordPermissionPolicy):
# note: even though this is closer to business logic than permissions,
# it was simpler and less coupling to implement this as permission check
IfTransferType(LOCAL_TRANSFER_TYPE, can_read_files),
IfTransferType(LOCAL_STAGED_TRANSFER_TYPE, can_read_files),
SystemProcess(),
]

Expand All @@ -216,16 +223,19 @@ class ZenodoRDMRecordPermissionPolicy(RDMRecordPermissionPolicy):
can_draft_media_read_files = can_draft_read_files
can_draft_media_set_content_files = [
IfTransferType(LOCAL_TRANSFER_TYPE, can_draft_media_create_files),
IfTransferType(LOCAL_STAGED_TRANSFER_TYPE, can_draft_media_create_files),
SystemProcess(),
]
can_draft_media_get_content_files = [
# preview is same as read_files
IfTransferType(LOCAL_TRANSFER_TYPE, can_get_content_files),
IfTransferType(LOCAL_STAGED_TRANSFER_TYPE, can_get_content_files),
SystemProcess(),
]
can_draft_media_commit_files = [
# review is the same as create_files
IfTransferType(LOCAL_TRANSFER_TYPE, can_draft_media_create_files),
IfTransferType(LOCAL_STAGED_TRANSFER_TYPE, can_draft_media_create_files),
SystemProcess(),
]
can_draft_media_update_files = can_draft_media_create_files
Expand Down
Loading