Skip to content

Commit

Permalink
permissions: temporary fix for submitting a record to community
Browse files Browse the repository at this point in the history
  • Loading branch information
zzacharo committed Aug 17, 2023
1 parent 56fa837 commit cb7e601
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
11 changes: 10 additions & 1 deletion invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import os

from datetime import datetime
from invenio_i18n import lazy_gettext as _
from cds_rdm.permissions import CDSCommunitiesPermissionPolicy
from cds_rdm.permissions import (
CDSCommunitiesPermissionPolicy,
CDSRDMRecordPermissionPolicy
)
from invenio_app_rdm.config import CELERY_BEAT_SCHEDULE as APP_RDM_CELERY_BEAT_SCHEDULE
from celery.schedules import crontab

Expand Down Expand Up @@ -128,6 +131,12 @@ BASE_TEMPLATE = "cds_rdm/page.html"
INSTANCE_THEME_FILE = './less/theme.less'


# Invenio-rdm-records
# ===================

# Revert this when we manage to deploy latest app-rdm in prod
RDM_PERMISSION_POLICY = CDSRDMRecordPermissionPolicy

# Invenio-communities
# ===================
# Communities permission policy
Expand Down
14 changes: 14 additions & 0 deletions site/cds_rdm/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""Permission policy."""

from invenio_communities.permissions import CommunityPermissionPolicy
from invenio_rdm_records.services.permissions import RDMRecordPermissionPolicy
from invenio_records_permissions.generators import SystemProcess

from .generators import CERNEmailsGroups
Expand All @@ -25,3 +26,16 @@ class CDSCommunitiesPermissionPolicy(CommunityPermissionPolicy):
),
SystemProcess(),
]


class CDSRDMRecordPermissionPolicy(RDMRecordPermissionPolicy):
"""RDM record permission policy of CDS.
NOTE: THIS should be reverted once the latest code is deployed in prod!!!
"""

#
# Record communities
#
# Who can add record to a community
can_add_community = RDMRecordPermissionPolicy.can_manage

0 comments on commit cb7e601

Please sign in to comment.