mirror of
https://github.com/Cian-H/invenio-config-iform.git
synced 2026-08-15 00:53:22 +01:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4207fff72 | ||
|
|
6e6f26e8b8 | ||
|
|
338ac45bfa | ||
|
|
a198ac5365 | ||
|
|
afab433e52 |
@@ -8,4 +8,4 @@
|
||||
|
||||
"""Metadata for this python module."""
|
||||
|
||||
__version__ = "2026.8.12"
|
||||
__version__ = "2026.8.14.1"
|
||||
|
||||
@@ -225,8 +225,8 @@ RECAPTCHA_PRIVATE_KEY = None
|
||||
# See:
|
||||
# https://invenio-records-permissions.readthedocs.io/en/latest/configuration.html
|
||||
# Uncomment these to enable overriding RDM permissions
|
||||
# from .rdm_permissions import IformRDMRecordServiceConfig
|
||||
# RDM_RECORDS_BIBLIOGRAPHIC_SERVICE_CONFIG = IformRDMRecordServiceConfig
|
||||
from .permissions import IformRDMRecordPermissionPolicy
|
||||
RDM_PERMISSION_POLICY = IformRDMRecordPermissionPolicy
|
||||
"""Access control configuration for records."""
|
||||
|
||||
# invenio-rdm-records
|
||||
|
||||
@@ -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