mirror of
https://github.com/Cian-H/invenio-config-iform.git
synced 2026-08-14 16:43:23 +01:00
Fixed error in record management config
This commit is contained in:
@@ -34,7 +34,6 @@ from invenio_rdm_records.services.generators import (
|
||||
IfAtLeastOneCommunity,
|
||||
IfDeleted,
|
||||
IfExternalDOIRecord,
|
||||
IfFileIsLocal,
|
||||
IfNewRecord,
|
||||
IfOneCommunity,
|
||||
IfRecordDeleted,
|
||||
@@ -45,6 +44,10 @@ from invenio_rdm_records.services.generators import (
|
||||
SecretLinks,
|
||||
SubmissionReviewer,
|
||||
)
|
||||
from invenio_records_resources.services.files.generators import IfTransferType
|
||||
from invenio_records_resources.services.files.transfer import (
|
||||
LOCAL_TRANSFER_TYPE,
|
||||
)
|
||||
from invenio_records_permissions.generators import AnyUser, Disable, IfConfig, SystemProcess
|
||||
from invenio_records_permissions.policies.records import RecordPermissionPolicy
|
||||
from invenio_users_resources.services.permissions import UserManager
|
||||
@@ -123,7 +126,7 @@ class IformRDMRecordPermissionPolicy(RecordPermissionPolicy):
|
||||
ResourceAccessToken("read"),
|
||||
]
|
||||
can_get_content_files = [
|
||||
IfFileIsLocal(then_=can_read_files, else_=[SystemProcess()]),
|
||||
IfTransferType(LOCAL_TRANSFER_TYPE, then_=can_read_files, else_=[SystemProcess()]),
|
||||
]
|
||||
can_create = can_iform_authenticated
|
||||
|
||||
@@ -136,12 +139,12 @@ class IformRDMRecordPermissionPolicy(RecordPermissionPolicy):
|
||||
can_update_draft = can_review
|
||||
can_draft_create_files = can_review
|
||||
can_draft_set_content_files = [
|
||||
IfFileIsLocal(then_=can_review, else_=[SystemProcess()]),
|
||||
IfTransferType(LOCAL_TRANSFER_TYPE, then_=can_review, else_=[SystemProcess()]),
|
||||
]
|
||||
can_draft_get_content_files = [
|
||||
IfFileIsLocal(then_=can_draft_read_files, else_=[SystemProcess()]),
|
||||
IfTransferType(LOCAL_TRANSFER_TYPE, then_=can_draft_read_files, else_=[SystemProcess()]),
|
||||
]
|
||||
can_draft_commit_files = [IfFileIsLocal(then_=can_review, else_=[SystemProcess()])]
|
||||
can_draft_commit_files = [IfTransferType(LOCAL_TRANSFER_TYPE, then_=can_review, else_=[SystemProcess()])]
|
||||
can_draft_update_files = can_review
|
||||
can_draft_delete_files = can_review
|
||||
can_manage_files = [
|
||||
@@ -221,13 +224,13 @@ class IformRDMRecordPermissionPolicy(RecordPermissionPolicy):
|
||||
can_draft_media_create_files = can_review
|
||||
can_draft_media_read_files = can_review
|
||||
can_draft_media_set_content_files = [
|
||||
IfFileIsLocal(then_=can_review, else_=[SystemProcess()]),
|
||||
IfTransferType(LOCAL_TRANSFER_TYPE, then_=can_review, else_=[SystemProcess()]),
|
||||
]
|
||||
can_draft_media_get_content_files = [
|
||||
IfFileIsLocal(then_=can_preview, else_=[SystemProcess()]),
|
||||
IfTransferType(LOCAL_TRANSFER_TYPE, then_=can_preview, else_=[SystemProcess()]),
|
||||
]
|
||||
can_draft_media_commit_files = [
|
||||
IfFileIsLocal(then_=can_preview, else_=[SystemProcess()]),
|
||||
IfTransferType(LOCAL_TRANSFER_TYPE, then_=can_preview, else_=[SystemProcess()]),
|
||||
]
|
||||
can_draft_media_delete_files = can_review
|
||||
can_draft_media_update_files = can_review
|
||||
@@ -240,7 +243,7 @@ class IformRDMRecordPermissionPolicy(RecordPermissionPolicy):
|
||||
ResourceAccessToken("read"),
|
||||
]
|
||||
can_media_get_content_files = [
|
||||
IfFileIsLocal(then_=can_read, else_=[SystemProcess()]),
|
||||
IfTransferType(LOCAL_TRANSFER_TYPE, then_=can_read, else_=[SystemProcess()]),
|
||||
]
|
||||
can_media_create_files = [Disable()]
|
||||
can_media_set_content_files = [Disable()]
|
||||
|
||||
Reference in New Issue
Block a user