diff --git a/invenio.cfg b/invenio.cfg index 0225efb..085ddc4 100644 --- a/invenio.cfg +++ b/invenio.cfg @@ -7,601 +7,6 @@ For the full list of settings and their values, see https://inveniordm.docs.cern.ch/reference/configuration/. """ -import os +from cds_rdm import config -from copy import deepcopy -from datetime import datetime, timedelta - -from cds_rdm import schemes -from cds_rdm.custom_fields import CUSTOM_FIELDS, CUSTOM_FIELDS_UI, NAMESPACES -from cds_rdm.permissions import ( - CDSCommunitiesPermissionPolicy, - CDSRDMRecordPermissionPolicy, - CDSRDMPreservationSyncPermissionPolicy, lock_edit_record_published_files, -) -from cds_rdm.files import storage_factory -from cds_rdm.inspire_harvester.reader import InspireHTTPReader -from cds_rdm.inspire_harvester.transformer import InspireJsonTransformer -from cds_rdm.inspire_harvester.writer import InspireWriter -from invenio_app_rdm.config import STATS_EVENTS as _APP_RDM_STATS_EVENTS, \ - STATS_AGGREGATIONS as _APP_RDM_STATS_AGGREGATIONS, APP_RDM_ROUTES -from invenio_rdm_records.checks import requests as checks_requests -from invenio_rdm_records.config import (always_valid, RDM_RECORDS_PERSONORG_SCHEMES, - RDM_RECORDS_IDENTIFIERS_SCHEMES as RDM_RECORDS_RELATED_IDENTIFIERS_SCHEMES - ) -from invenio_records_resources.services.records.queryparser import ( - QueryParser, - SearchFieldTransformer, -) -from invenio_rdm_records.proxies import current_rdm_records_service as record_service -from invenio_rdm_records.services.components import DefaultRecordsComponents -from invenio_rdm_records.config import ( - RDM_PERSISTENT_IDENTIFIERS, - RDM_PARENT_PERSISTENT_IDENTIFIERS, - RDM_SEARCH -) -from invenio_preservation_sync.utils import preservation_info_render -from invenio_cern_sync.users.profile import CERNUserProfileSchema -from invenio_oauthclient.views.client import auto_redirect_login -from invenio_cern_sync.sso import cern_remote_app_name, cern_keycloak - -from invenio_vocabularies.config import \ - VOCABULARIES_NAMES_SCHEMES as DEFAULT_VOCABULARIES_NAMES_SCHEMES - -from invenio_app_rdm.config import \ - VOCABULARIES_DATASTREAM_READERS as DEFAULT_VOCABULARIES_DATASTREAM_READERS -from invenio_app_rdm.config import \ - VOCABULARIES_DATASTREAM_TRANSFORMERS as DEFAULT_VOCABULARIES_DATASTREAM_TRANSFORMERS -from invenio_app_rdm.config import \ - VOCABULARIES_DATASTREAM_WRITERS as DEFAULT_VOCABULARIES_DATASTREAM_WRITERS -from cds_rdm.clc_sync.services.components import ClcSyncComponent -from cds_rdm.components import CDSResourcePublication -from cds_rdm.components import SubjectsValidationComponent -from cds_rdm.components import MintAlternateIdentifierComponent -from cds_rdm.pids import validate_optional_doi_transitions -from cds_rdm.views import frontpage_view_function, inspire_link_render - -from invenio_app_rdm.config import APP_RDM_RECORD_EXPORTERS as RECORD_EXPORTERS - - -def _(x): # needed to avoid start time failure with lazy strings - return x - -# Flask -# ===== -# See https://flask.palletsprojects.com/en/1.1.x/config/ - -# Define the value of the cache control header `max-age` returned by the server when serving -# public files. Files will be cached by the browser for the provided number of seconds. -# See flask documentation for more information: -# https://flask.palletsprojects.com/en/2.1.x/config/#SEND_FILE_MAX_AGE_DEFAULT -SEND_FILE_MAX_AGE_DEFAULT = 300 - -# SECURITY WARNING: keep the secret key used in production secret! -# Do not commit it to a source code repository. -# TODO: Set -SECRET_KEY = "CHANGE_ME" - -# Since HAProxy and Nginx route all requests no matter the host header -# provided, the allowed hosts variable is set to localhost. In production it -# should be set to the correct host and it is strongly recommended to only -# route correct hosts to the application. -TRUSTED_HOSTS = ['0.0.0.0', 'localhost', '127.0.0.1', 'localhost.cern.ch'] - -# Flask-SQLAlchemy -# ================ -# See https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/ - -# TODO: Set -SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://cds-rdm:cds-rdm@localhost/cds-rdm" - -# Invenio-App -# =========== -# See https://invenio-app.readthedocs.io/en/latest/configuration.html - -APP_DEFAULT_SECURE_HEADERS = { - 'content_security_policy': { - 'default-src': [ - "'self'", - 'data:', # for fonts - "'unsafe-inline'", # for inline scripts and styles - "blob:", # for pdf preview - "cdnjs.cloudflare.com", - # For CERN Matomo - "webanalytics.web.cern.ch", - "test-matomo-wf.web.cern.ch", - ], - }, - 'content_security_policy_report_only': False, - 'content_security_policy_report_uri': None, - 'force_file_save': False, - 'force_https': True, - 'force_https_permanent': False, - 'frame_options': 'sameorigin', - 'frame_options_allow_from': None, - 'session_cookie_http_only': True, - 'session_cookie_secure': True, - 'strict_transport_security': True, - 'strict_transport_security_include_subdomains': True, - 'strict_transport_security_max_age': 31556926, # One year in seconds - 'strict_transport_security_preload': False, -} - -# Flask-Babel -# =========== -# See https://python-babel.github.io/flask-babel/#configuration - -# Default locale (language) -BABEL_DEFAULT_LOCALE = 'en' -# Default time zone -BABEL_DEFAULT_TIMEZONE = 'Europe/Zurich' - -# Invenio-I18N -# ============ -# See https://invenio-i18n.readthedocs.io/en/latest/configuration.html - -# Other supported languages (do not include BABEL_DEFAULT_LOCALE in list). -I18N_LANGUAGES = [ - # ('de', _('German')), - # ('tr', _('Turkish')), -] - -# Invenio-Theme -# ============= -# See https://invenio-theme.readthedocs.io/en/latest/configuration.html - -# Frontpage title -THEME_FRONTPAGE_TITLE = "CERN Document Server" -# Header logo -THEME_LOGO = 'images/invenio-rdm.svg' -THEME_SHOW_FRONTPAGE_INTRO_SECTION = False - -THEME_SITENAME = 'CDS' -# Templates -# THEME_FRONTPAGE_TEMPLATE = 'cds_rdm/frontpage.html' -# THEME_FOOTER_TEMPLATE = 'cds_rdm/footer.html' -# THEME_HEADER_TEMPLATE = 'cds_rdm/header.html' - -# Site tracking code template for matomo analytics -# Enable the below on the dedicated environment -THEME_TRACKINGCODE_TEMPLATE = "cds_rdm/matomo-test.html" - -# Invenio-App-RDM -# =============== -# See https://invenio-app-rdm.readthedocs.io/en/latest/configuration.html - -# Instance's theme entrypoint file. Path relative to the ``assets/`` folder. -INSTANCE_THEME_FILE = './less/theme.less' - -APP_RDM_ROUTES["index"] = ("/", frontpage_view_function) - -# Invenio-communities -# =================== -# Communities permission policy -COMMUNITIES_PERMISSION_POLICY = CDSCommunitiesPermissionPolicy -COMMUNITIES_ADMINISTRATION_DISABLED = False -COMMUNITIES_ALLOW_RESTRICTED = True -COMMUNITIES_RECORDS_SEARCH = deepcopy(RDM_SEARCH) - -# Invenio-Records-Resources -# ========================= -# See https://github.com/inveniosoftware/invenio-records-resources/blob/master/invenio_records_resources/config.py - -# TODO: Set with your own hostname when deploying to production -SITE_UI_URL = "https://127.0.0.1" - -SITE_API_URL = "https://127.0.0.1/api" - -APP_RDM_DEPOSIT_FORM_DEFAULTS = { - "publication_date": lambda: datetime.now().strftime("%Y-%m-%d"), - "rights": [ - { - "id": "cc-by-4.0", - "title": "Creative Commons Attribution 4.0 International", - "description": ("The Creative Commons Attribution license allows " - "re-distribution and re-use of a licensed work " - "on the condition that the creator is " - "appropriately credited."), - "link": "https://creativecommons.org/licenses/by/4.0/legalcode", - } - ], - "publisher": "CERN", -} - -# See https://github.com/inveniosoftware/invenio-app-rdm/blob/master/invenio_app_rdm/config.py -APP_RDM_DEPOSIT_FORM_AUTOCOMPLETE_NAMES = 'search' # "search_only" or "off" - -# Invenio-RDM-Records -# =================== -# See https://inveniordm.docs.cern.ch/customize/dois/ -DATACITE_ENABLED = True -DATACITE_USERNAME = "" -DATACITE_PASSWORD = "" -DATACITE_PREFIX = "10.17181" -DATACITE_TEST_MODE = True -DATACITE_DATACENTER_SYMBOL = "" - -# Authentication - Invenio-Accounts and Invenio-OAuthclient -# ========================================================= -# See: https://inveniordm.docs.cern.ch/customize/authentication/ - -# Invenio-Accounts -# ================ -# See https://github.com/inveniosoftware/invenio-accounts/blob/master/invenio_accounts/config.py -ACCOUNTS_DEFAULT_USERS_VERIFIED = True # ensure that users are verified by default -ACCOUNTS_DEFAULT_USER_VISIBILITY = "public" # enables users to be searchable for invites -ACCOUNTS_DEFAULT_EMAIL_VISIBILITY = "public" -ACCOUNTS_LOCAL_LOGIN_ENABLED = True # enable local login -PERMANENT_SESSION_LIFETIME = timedelta(days=10) -SECURITY_REGISTERABLE = True # local login: allow users to register -SECURITY_RECOVERABLE = False # local login: allow users to reset the password -SECURITY_CHANGEABLE = False # local login: allow users to change psw -SECURITY_CONFIRMABLE = False # local login: users can confirm e-mail address -SECURITY_LOGIN_WITHOUT_CONFIRMATION = True # require users to confirm email before being able to login - -# Emails sending -# Disable sending all account-related emails because of CERN SSO usage -SECURITY_SEND_PASSWORD_CHANGE_EMAIL = False -SECURITY_SEND_PASSWORD_RESET_EMAIL = False -SECURITY_SEND_PASSWORD_RESET_NOTICE_EMAIL = False -SECURITY_SEND_REGISTER_EMAIL = False - -# Invenio-CERN-Sync/CERN SSO -# ========================== -OAUTHCLIENT_REMOTE_APPS = { - cern_remote_app_name: cern_keycloak.remote_app, -} - -CERN_APP_CREDENTIALS = { - "consumer_key": "CHANGE ME", - "consumer_secret": "CHANGE ME", -} -CERN_SYNC_KEYCLOAK_BASE_URL = "https://auth.cern.ch/" -CERN_SYNC_AUTHZ_BASE_URL = "https://authorization-service-api.web.cern.ch/" -INVENIO_CERN_SYNC_KEYCLOAK_BASE_URL = "https://auth.cern.ch/" # set env var when testing - -OAUTHCLIENT_CERN_REALM_URL = cern_keycloak.realm_url -OAUTHCLIENT_CERN_USER_INFO_URL = cern_keycloak.user_info_url -OAUTHCLIENT_CERN_VERIFY_EXP = True -OAUTHCLIENT_CERN_VERIFY_AUD = False -OAUTHCLIENT_CERN_USER_INFO_FROM_ENDPOINT = True - -ACCOUNTS_LOGIN_VIEW_FUNCTION = auto_redirect_login # autoredirect to external login if enabled -OAUTHCLIENT_AUTO_REDIRECT_TO_EXTERNAL_LOGIN = True # autoredirect to external login - -ACCOUNTS_USER_PROFILE_SCHEMA = CERNUserProfileSchema() - -# Invenio-UserProfiles -# ==================== -USERPROFILES_READ_ONLY = True # disable change of user profile -USERPROFILES_EXTEND_SECURITY_FORMS = True # automatically use user's email address as account email - -# OAI-PMH -# ======= -OAISERVER_ID_PREFIX = "127.0.0.1:5000" -"""The prefix that will be applied to the generated OAI-PMH ids.""" - -OAISERVER_ADMIN_EMAILS = ["CHANGE_ME"] -"""The email address of the OAI-PMH administrator.""" - -OAISERVER_XSL_URL = "/static/oai2.xsl" -"""The URL to the XSLT stylesheet for OAI-PMH""" - -# Invenio-Search -# ============== -SEARCH_INDEX_PREFIX = "cds-rdm-" - -############################################################################### -# CDS-RDM configuration -############################################################################### -CDS_SERVICE_ELEMENT_URL = "https://cern.service-now.com/service-portal?id=service_element&name=CDS-Service" - -# Permissions: define who can create new communities -CDS_EMAILS_ALLOW_CREATE_COMMUNITIES = [] -CDS_GROUPS_ALLOW_CREATE_COMMUNITIES = [] - -CDS_ENVIRONMENT_NAME = "local" -"""The environment name, used in the side banner to distinguish between -different instances. - -Available options are: 'local', 'development', 'sandbox', 'production'. -If set to 'production', the side banner is not shown. -""" - -# Invenio-Files-REST -# ================== -XROOTD_ENABLED = False -# control file download offloading -FILES_REST_STORAGE_FACTORY = storage_factory -FILES_REST_XSENDFILE_ENABLED = False -CDS_EOS_OFFLOAD_ENABLED = False -CDS_LOCAL_OFFLOAD_ENABLED = False -CDS_LOCAL_OFFLOAD_FILES = ["file.txt", "file2.txt"] -CDS_LOCAL_OFFLOAD_STORAGE = "" - -CDS_EOS_OFFLOAD_HTTPHOST = "" -# Specifies whether to use X509 authentication for EOS offload -CDS_EOS_OFFLOAD_AUTH_X509 = False -# The path to the X509 certificate file -CDS_EOS_OFFLOAD_X509_CERT_PATH = "" -# The path to the X509 private key file -CDS_EOS_OFFLOAD_X509_KEY_PATH = "" -# check nginx config for more details -CDS_EOS_OFFLOAD_REDIRECT_BASE_PATH = "" - -CDS_CERN_SCIENTIFIC_COMMUNITY_ID = "c2c46ab3-5fb4-4d86-83c6-5d9dc8392d6f" -"""The id of the CERN Scientific community.""" - -CHECKS_ENABLED = True -"""Enable metadata checks.""" - -RDM_COMMUNITY_SUBMISSION_REQUEST_CLS = checks_requests.CommunitySubmission - -RDM_COMMUNITY_INCLUSION_REQUEST_CLS = checks_requests.CommunityInclusion -# require a community when publishing -RDM_COMMUNITY_REQUIRED_TO_PUBLISH = True - -RDM_SEARCH = { - **deepcopy(RDM_SEARCH), - "query_parser_cls": QueryParser.factory( - mapping={ - "accelerator": "custom_fields.cern\:accelerators.title.en", - "accelerator.id": "custom_fields.cern\:accelerators.id", - "accelerator.title": "custom_fields.cern\:accelerators.title.en", - "accelerators": "custom_fields.cern\:accelerators.title.en", - "accelerators.id": "custom_fields.cern\:accelerators.id", - "accelerators.title": "custom_fields.cern\:accelerators.title.en", - "experiment": "custom_fields.cern\:experiments.title.en", - "experiment.id": "custom_fields.cern\:experiments.id", - "experiment.title": "custom_fields.cern\:experiments.title.en", - "experiments": "custom_fields.cern\:experiments.title.en", - "experiments.id": "custom_fields.cern\:experiments.id", - "experiments.title": "custom_fields.cern\:experiments.title.en", - "department": "custom_fields.cern\:departments.title.en", - "department.id": "custom_fields.cern\:departments.id", - "department.title": "custom_fields.cern\:departments.title.en", - "departments": "custom_fields.cern\:departments.title.en", - "departments.id": "custom_fields.cern\:departments.id", - "departments.title": "custom_fields.cern\:departments.title.en", - "programme": "custom_fields.cern\:programmes.title.en", - "programme.id": "custom_fields.cern\:programmes.id", - "programme.title": "custom_fields.cern\:programmes.title.en", - "programmes": "custom_fields.cern\:programmes.title.en", - "programmes.id": "custom_fields.cern\:programmes.id", - "programmes.title": "custom_fields.cern\:programmes.title.en", - "project": "custom_fields.cern\:projects", - "projects": "custom_fields.cern\:projects", - "study": "custom_fields.cern\:studies", - "studies": "custom_fields.cern\:studies", - }, - tree_transformer_cls=SearchFieldTransformer, - ), -} - -RDM_PERMISSION_POLICY = CDSRDMRecordPermissionPolicy - -# Static pages -APP_RDM_PAGES = { - "about": "/about", - "privacy-notice": "/privacy-notice", - "terms": "/terms", - "content-policy": "/content-policy", - "preservation-policy": "/preservation-policy", -} - -# Custom fields -RDM_NAMESPACES = { - **NAMESPACES -} -RDM_CUSTOM_FIELDS = CUSTOM_FIELDS -RDM_CUSTOM_FIELDS_UI = CUSTOM_FIELDS_UI - -# Require files for user upload -RDM_ALLOW_METADATA_ONLY_RECORDS = False - -THEME_MATHJAX_CDN = ( - "//cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js" - "?config=TeX-AMS-MML_HTMLorMML" -) - -RDM_FILES_DEFAULT_QUOTA_SIZE = 50 * 10 ** 9 # 50GB -RDM_FILES_DEFAULT_MAX_FILE_SIZE = 50 * 10 ** 9 # 50GB - -JOBS_ADMINISTRATION_ENABLED = True - -RDM_RECORDS_IDENTIFIERS_SCHEMES = { - "cdsrn": {"label": _("CDS Report Number"), - "validator": always_valid, - "datacite": "CDS"}, - "aleph": {"label": _("Aleph number"), - "validator": schemes.is_aleph, - "datacite": "ALEPH"}, - "cds": {"label": _("CDS"), - "validator": schemes.is_cds, - "datacite": "CDS" - } -} - -RDM_RECORDS_RELATED_IDENTIFIERS_SCHEMES = { - **RDM_RECORDS_RELATED_IDENTIFIERS_SCHEMES, - **{ - "inspire": { - "label": _("Inspire"), - "validator": schemes.is_inspire, - "datacite": "INSPIRE" - }, - "inis": { - "label": _("INIS"), - "validator": lambda val: str(val).isdigit(), - "datacite": "INIS" - }, - "indico": { - "label": _("Indico"), - "validator": schemes.is_indico, - "datacite": "INDICO" - }, - "hal": { - "label": "HAL", - "validator": schemes.is_hal, - "datacite": "HAL" - } - }, - # keep internal identifiers' schemes for internal record relations - **RDM_RECORDS_IDENTIFIERS_SCHEMES -} - -# Map INSPIRE Identifiers schemes to InvenioRDM ones -# Format: INSPIRE_SCHEME: INVENIO_RDM_SCHEME -CDS_INSPIRE_IDS_SCHEMES_MAPPING = { - "hdl": "handle", -} - -RDM_RECORDS_PERSONORG_SCHEMES = { - **RDM_RECORDS_PERSONORG_SCHEMES, - **{"inspire_author": {"label": _("Inspire"), - "validator": schemes.is_inspire_author, - "datacite": "INSPIRE"}, - "cds": {"label": _("CDS"), - "validator": schemes.is_cds, - "datacite": "CDS"} - } -} - -RDM_RECORDS_SERVICE_COMPONENTS = [ - SubjectsValidationComponent, - *DefaultRecordsComponents, - CDSResourcePublication, - ClcSyncComponent, - MintAlternateIdentifierComponent, -] - -### Do not require DOIs for record and parent -RDM_PERSISTENT_IDENTIFIERS["doi"]["required"] = False -RDM_PARENT_PERSISTENT_IDENTIFIERS["doi"]["required"] = False -RDM_PERSISTENT_IDENTIFIERS["doi"]["ui"][ - "default_selected"] = "not_needed" # "yes", "no" or "not_needed" - -RDM_OPTIONAL_DOI_VALIDATOR = validate_optional_doi_transitions - - -RDM_LOCK_EDIT_PUBLISHED_FILES = lock_edit_record_published_files -"""Lock editing already published files (enforce record versioning).""" - -# Invenio-requests -# ========================= - -REQUESTS_REVIEWERS_ENABLED = True -"""Enable reviewers for requests.""" - -REQUESTS_REVIEWERS_MAX_NUMBER = 15 -"""Maximum number of reviewers allowed for a request.""" - -# Invenio-Preservation-Sync -# ========================= - -PRESERVATION_SYNC_ENABLED = True - - -def resolve_record_pid(pid): - return record_service.record_cls.pid.resolve(pid).id - - -PRESERVATION_SYNC_PID_RESOLVER = resolve_record_pid - -PRESERVATION_SYNC_PERMISSION_POLICY = CDSRDMPreservationSyncPermissionPolicy - -PRESERVATION_SYNC_GET_LIST_PATH = "/records//preservations" - -PRESERVATION_SYNC_GET_LATEST_PATH = "/records//preservations/latest" - -PRESERVATION_SYNC_UI_TITLE = "CERN Digital Memory" - -PRESERVATION_SYNC_UI_INFO_LINK = "/preservation-policy" - -PRESERVATION_SYNC_UI_ICON_PATH = "images/dm_logo.png" - -APP_RDM_RECORD_LANDING_PAGE_EXTERNAL_LINKS = [ - {"id": "preservation", "render": preservation_info_render}, - {"id": "inspire", "render": inspire_link_render}, -] - -# Invenio-Previewer -# ========================= -# TODO-EV uncomment this line -# PREVIEWER_PREFERENCE = DEFAULT_PREVIEWER_PREFERENCE + [ -# "cds_rdm_gltf_previewer", -# ] - -VOCABULARIES_NAMES_SCHEMES = { - **DEFAULT_VOCABULARIES_NAMES_SCHEMES, - "inspire_author": {"label": _("Inspire"), - "validator": schemes.is_inspire_author, - "datacite": "INSPIRE"}, - "cds": {"label": _("CDS"), "validator": schemes.is_cds, "datacite": "CDS"}, -} -"""Names allowed identifier schemes.""" - -VOCABULARIES_DATASTREAM_READERS = { - **DEFAULT_VOCABULARIES_DATASTREAM_READERS, - "inspire-http-reader": InspireHTTPReader, -} -"""Data Streams readers.""" - -VOCABULARIES_DATASTREAM_TRANSFORMERS = { - **DEFAULT_VOCABULARIES_DATASTREAM_TRANSFORMERS, - "inspire-json-transformer": InspireJsonTransformer, -} -"""Data Streams transformers.""" - -VOCABULARIES_DATASTREAM_WRITERS = { - **DEFAULT_VOCABULARIES_DATASTREAM_WRITERS, - "inspire-writer": InspireWriter, -} -"""Data Streams writers.""" - -# Invenio Stats -# ============= - -# We override the templates to add new fields needed for the migrated statistic events -_APP_RDM_STATS_EVENTS["file-download"][ - "templates"] = "cds_rdm.stats.templates.events.file_download" -_APP_RDM_STATS_EVENTS["record-view"][ - "templates"] = "cds_rdm.stats.templates.events.record_view" - -# Add the yearly suffix -_APP_RDM_STATS_EVENTS["file-download"]["params"]["suffix"] = "%Y" -_APP_RDM_STATS_EVENTS["record-view"]["params"]["suffix"] = "%Y" - -# Override the index_interval to be year -_APP_RDM_STATS_AGGREGATIONS["file-download-agg"]["params"]["index_interval"] = "year" -_APP_RDM_STATS_AGGREGATIONS["record-view-agg"]["params"]["index_interval"] = "year" - -STATS_EVENTS = _APP_RDM_STATS_EVENTS -STATS_AGGREGATIONS = _APP_RDM_STATS_AGGREGATIONS - -APP_RDM_RECORD_LANDING_PAGE_TEMPLATE = "cds_rdm/records/detail.html" - -RDM_DETAIL_SIDE_BAR_MANAGE_ATTRIBUTES_EXTENSION_TEMPLATE = "cds_rdm/records/manage_menu.html" - -_RECORD_EXPORTERS = { - **RECORD_EXPORTERS, - "bibtex": { - "name": _("BibTeX (DOI for this version)"), - "serializer": ("invenio_rdm_records.resources.serializers:BibtexSerializer"), - "params": {}, - "content-type": "application/x-bibtex", - "filename": "{id}.bib", - }, - "bibtex-allversions": { - "name": _("BibTeX (DOI for all versions)"), - "serializer": ("invenio_rdm_records.resources.serializers:BibtexSerializer"), - "params": {"schema_context": {"doi_all_versions": True}}, - "content-type": "application/x-bibtex", - "filename": "{id}-allversions.bib", - }, -} -APP_RDM_RECORD_EXPORTERS = dict(sorted(_RECORD_EXPORTERS.items())) - -ADMINISTRATION_BASE_TEMPLATE = "cds_rdm/administration/admin_base_template.html" -LOGGING_CONSOLE_LEVEL = "INFO" -JOBS_LOGGING_LEVEL = "INFO" +globals().update(vars(config)) \ No newline at end of file diff --git a/site/cds_rdm/config.py b/site/cds_rdm/config.py index f844f5f..70c011a 100644 --- a/site/cds_rdm/config.py +++ b/site/cds_rdm/config.py @@ -9,6 +9,603 @@ from invenio_i18n import lazy_gettext as _ from invenio_records_resources.services.records.facets import TermsFacet +from copy import deepcopy +from datetime import datetime, timedelta + +from cds_rdm import schemes +from cds_rdm.custom_fields import CUSTOM_FIELDS, CUSTOM_FIELDS_UI, NAMESPACES +from cds_rdm.permissions import ( + CDSCommunitiesPermissionPolicy, + CDSRDMRecordPermissionPolicy, + CDSRDMPreservationSyncPermissionPolicy, lock_edit_record_published_files, +) +from cds_rdm.files import storage_factory +from cds_rdm.inspire_harvester.reader import InspireHTTPReader +from cds_rdm.inspire_harvester.transformer import InspireJsonTransformer +from cds_rdm.inspire_harvester.writer import InspireWriter +from invenio_app_rdm.config import STATS_EVENTS as _APP_RDM_STATS_EVENTS, \ + STATS_AGGREGATIONS as _APP_RDM_STATS_AGGREGATIONS, APP_RDM_ROUTES +from invenio_rdm_records.checks import requests as checks_requests +from invenio_rdm_records.config import (always_valid, RDM_RECORDS_PERSONORG_SCHEMES, + RDM_RECORDS_IDENTIFIERS_SCHEMES as RDM_RECORDS_RELATED_IDENTIFIERS_SCHEMES + ) +from invenio_records_resources.services.records.queryparser import ( + QueryParser, + SearchFieldTransformer, +) +from invenio_rdm_records.proxies import current_rdm_records_service as record_service +from invenio_rdm_records.services.components import DefaultRecordsComponents +from invenio_rdm_records.config import ( + RDM_PERSISTENT_IDENTIFIERS, + RDM_PARENT_PERSISTENT_IDENTIFIERS, + RDM_SEARCH +) +from invenio_preservation_sync.utils import preservation_info_render +from invenio_cern_sync.users.profile import CERNUserProfileSchema +from invenio_oauthclient.views.client import auto_redirect_login +from invenio_cern_sync.sso import cern_remote_app_name, cern_keycloak + +from invenio_vocabularies.config import \ + VOCABULARIES_NAMES_SCHEMES as DEFAULT_VOCABULARIES_NAMES_SCHEMES + +from invenio_app_rdm.config import \ + VOCABULARIES_DATASTREAM_READERS as DEFAULT_VOCABULARIES_DATASTREAM_READERS +from invenio_app_rdm.config import \ + VOCABULARIES_DATASTREAM_TRANSFORMERS as DEFAULT_VOCABULARIES_DATASTREAM_TRANSFORMERS +from invenio_app_rdm.config import \ + VOCABULARIES_DATASTREAM_WRITERS as DEFAULT_VOCABULARIES_DATASTREAM_WRITERS +from cds_rdm.clc_sync.services.components import ClcSyncComponent +from cds_rdm.components import CDSResourcePublication +from cds_rdm.components import SubjectsValidationComponent +from cds_rdm.components import MintAlternateIdentifierComponent +from cds_rdm.pids import validate_optional_doi_transitions +from cds_rdm.views import frontpage_view_function, inspire_link_render + +from invenio_app_rdm.config import APP_RDM_RECORD_EXPORTERS as RECORD_EXPORTERS + + +def _(x): # needed to avoid start time failure with lazy strings + return x + +# Flask +# ===== +# See https://flask.palletsprojects.com/en/1.1.x/config/ + +# Define the value of the cache control header `max-age` returned by the server when serving +# public files. Files will be cached by the browser for the provided number of seconds. +# See flask documentation for more information: +# https://flask.palletsprojects.com/en/2.1.x/config/#SEND_FILE_MAX_AGE_DEFAULT +SEND_FILE_MAX_AGE_DEFAULT = 300 + +# SECURITY WARNING: keep the secret key used in production secret! +# Do not commit it to a source code repository. +# TODO: Set +SECRET_KEY = "CHANGE_ME" + +# Since HAProxy and Nginx route all requests no matter the host header +# provided, the allowed hosts variable is set to localhost. In production it +# should be set to the correct host and it is strongly recommended to only +# route correct hosts to the application. +TRUSTED_HOSTS = ['0.0.0.0', 'localhost', '127.0.0.1', 'localhost.cern.ch'] + +# Flask-SQLAlchemy +# ================ +# See https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/ + +# TODO: Set +SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://cds-rdm:cds-rdm@localhost/cds-rdm" + +# Invenio-App +# =========== +# See https://invenio-app.readthedocs.io/en/latest/configuration.html + +APP_DEFAULT_SECURE_HEADERS = { + 'content_security_policy': { + 'default-src': [ + "'self'", + 'data:', # for fonts + "'unsafe-inline'", # for inline scripts and styles + "blob:", # for pdf preview + "cdnjs.cloudflare.com", + # For CERN Matomo + "webanalytics.web.cern.ch", + "test-matomo-wf.web.cern.ch", + ], + }, + 'content_security_policy_report_only': False, + 'content_security_policy_report_uri': None, + 'force_file_save': False, + 'force_https': True, + 'force_https_permanent': False, + 'frame_options': 'sameorigin', + 'frame_options_allow_from': None, + 'session_cookie_http_only': True, + 'session_cookie_secure': True, + 'strict_transport_security': True, + 'strict_transport_security_include_subdomains': True, + 'strict_transport_security_max_age': 31556926, # One year in seconds + 'strict_transport_security_preload': False, +} + +# Flask-Babel +# =========== +# See https://python-babel.github.io/flask-babel/#configuration + +# Default locale (language) +BABEL_DEFAULT_LOCALE = 'en' +# Default time zone +BABEL_DEFAULT_TIMEZONE = 'Europe/Zurich' + +# Invenio-I18N +# ============ +# See https://invenio-i18n.readthedocs.io/en/latest/configuration.html + +# Other supported languages (do not include BABEL_DEFAULT_LOCALE in list). +I18N_LANGUAGES = [ + # ('de', _('German')), + # ('tr', _('Turkish')), +] + +# Invenio-Theme +# ============= +# See https://invenio-theme.readthedocs.io/en/latest/configuration.html + +# Frontpage title +THEME_FRONTPAGE_TITLE = "CERN Document Server" +# Header logo +THEME_LOGO = 'images/invenio-rdm.svg' +THEME_SHOW_FRONTPAGE_INTRO_SECTION = False + +THEME_SITENAME = 'CDS' +# Templates +# THEME_FRONTPAGE_TEMPLATE = 'cds_rdm/frontpage.html' +# THEME_FOOTER_TEMPLATE = 'cds_rdm/footer.html' +# THEME_HEADER_TEMPLATE = 'cds_rdm/header.html' + +# Site tracking code template for matomo analytics +# Enable the below on the dedicated environment +THEME_TRACKINGCODE_TEMPLATE = "cds_rdm/matomo-test.html" + +# Invenio-App-RDM +# =============== +# See https://invenio-app-rdm.readthedocs.io/en/latest/configuration.html + +# Instance's theme entrypoint file. Path relative to the ``assets/`` folder. +INSTANCE_THEME_FILE = './less/theme.less' + +APP_RDM_ROUTES["index"] = ("/", frontpage_view_function) + +# Invenio-communities +# =================== +# Communities permission policy +COMMUNITIES_PERMISSION_POLICY = CDSCommunitiesPermissionPolicy +COMMUNITIES_ADMINISTRATION_DISABLED = False +COMMUNITIES_ALLOW_RESTRICTED = True +COMMUNITIES_RECORDS_SEARCH = deepcopy(RDM_SEARCH) + +# Invenio-Records-Resources +# ========================= +# See https://github.com/inveniosoftware/invenio-records-resources/blob/master/invenio_records_resources/config.py + +# TODO: Set with your own hostname when deploying to production +SITE_UI_URL = "https://127.0.0.1" + +SITE_API_URL = "https://127.0.0.1/api" + +APP_RDM_DEPOSIT_FORM_DEFAULTS = { + "publication_date": lambda: datetime.now().strftime("%Y-%m-%d"), + "rights": [ + { + "id": "cc-by-4.0", + "title": "Creative Commons Attribution 4.0 International", + "description": ("The Creative Commons Attribution license allows " + "re-distribution and re-use of a licensed work " + "on the condition that the creator is " + "appropriately credited."), + "link": "https://creativecommons.org/licenses/by/4.0/legalcode", + } + ], + "publisher": "CERN", +} + +# See https://github.com/inveniosoftware/invenio-app-rdm/blob/master/invenio_app_rdm/config.py +APP_RDM_DEPOSIT_FORM_AUTOCOMPLETE_NAMES = 'search' # "search_only" or "off" + +# Invenio-RDM-Records +# =================== +# See https://inveniordm.docs.cern.ch/customize/dois/ +DATACITE_ENABLED = True +DATACITE_USERNAME = "" +DATACITE_PASSWORD = "" +DATACITE_PREFIX = "10.17181" +DATACITE_TEST_MODE = True +DATACITE_DATACENTER_SYMBOL = "" + +# Authentication - Invenio-Accounts and Invenio-OAuthclient +# ========================================================= +# See: https://inveniordm.docs.cern.ch/customize/authentication/ + +# Invenio-Accounts +# ================ +# See https://github.com/inveniosoftware/invenio-accounts/blob/master/invenio_accounts/config.py +ACCOUNTS_DEFAULT_USERS_VERIFIED = True # ensure that users are verified by default +ACCOUNTS_DEFAULT_USER_VISIBILITY = "public" # enables users to be searchable for invites +ACCOUNTS_DEFAULT_EMAIL_VISIBILITY = "public" +ACCOUNTS_LOCAL_LOGIN_ENABLED = True # enable local login +PERMANENT_SESSION_LIFETIME = timedelta(days=10) +SECURITY_REGISTERABLE = True # local login: allow users to register +SECURITY_RECOVERABLE = False # local login: allow users to reset the password +SECURITY_CHANGEABLE = False # local login: allow users to change psw +SECURITY_CONFIRMABLE = False # local login: users can confirm e-mail address +SECURITY_LOGIN_WITHOUT_CONFIRMATION = True # require users to confirm email before being able to login + +# Emails sending +# Disable sending all account-related emails because of CERN SSO usage +SECURITY_SEND_PASSWORD_CHANGE_EMAIL = False +SECURITY_SEND_PASSWORD_RESET_EMAIL = False +SECURITY_SEND_PASSWORD_RESET_NOTICE_EMAIL = False +SECURITY_SEND_REGISTER_EMAIL = False + +# Invenio-CERN-Sync/CERN SSO +# ========================== +OAUTHCLIENT_REMOTE_APPS = { + cern_remote_app_name: cern_keycloak.remote_app, +} + +CERN_APP_CREDENTIALS = { + "consumer_key": "CHANGE ME", + "consumer_secret": "CHANGE ME", +} +CERN_SYNC_KEYCLOAK_BASE_URL = "https://auth.cern.ch/" +CERN_SYNC_AUTHZ_BASE_URL = "https://authorization-service-api.web.cern.ch/" +INVENIO_CERN_SYNC_KEYCLOAK_BASE_URL = "https://auth.cern.ch/" # set env var when testing + +OAUTHCLIENT_CERN_REALM_URL = cern_keycloak.realm_url +OAUTHCLIENT_CERN_USER_INFO_URL = cern_keycloak.user_info_url +OAUTHCLIENT_CERN_VERIFY_EXP = True +OAUTHCLIENT_CERN_VERIFY_AUD = False +OAUTHCLIENT_CERN_USER_INFO_FROM_ENDPOINT = True + +ACCOUNTS_LOGIN_VIEW_FUNCTION = auto_redirect_login # autoredirect to external login if enabled +OAUTHCLIENT_AUTO_REDIRECT_TO_EXTERNAL_LOGIN = True # autoredirect to external login + +ACCOUNTS_USER_PROFILE_SCHEMA = CERNUserProfileSchema() + +# Invenio-UserProfiles +# ==================== +USERPROFILES_READ_ONLY = True # disable change of user profile +USERPROFILES_EXTEND_SECURITY_FORMS = True # automatically use user's email address as account email + +# OAI-PMH +# ======= +OAISERVER_ID_PREFIX = "127.0.0.1:5000" +"""The prefix that will be applied to the generated OAI-PMH ids.""" + +OAISERVER_ADMIN_EMAILS = ["CHANGE_ME"] +"""The email address of the OAI-PMH administrator.""" + +OAISERVER_XSL_URL = "/static/oai2.xsl" +"""The URL to the XSLT stylesheet for OAI-PMH""" + +# Invenio-Search +# ============== +SEARCH_INDEX_PREFIX = "cds-rdm-" + +############################################################################### +# CDS-RDM configuration +############################################################################### +CDS_SERVICE_ELEMENT_URL = "https://cern.service-now.com/service-portal?id=service_element&name=CDS-Service" + +# Permissions: define who can create new communities +CDS_EMAILS_ALLOW_CREATE_COMMUNITIES = [] +CDS_GROUPS_ALLOW_CREATE_COMMUNITIES = [] + +CDS_ENVIRONMENT_NAME = "local" +"""The environment name, used in the side banner to distinguish between +different instances. + +Available options are: 'local', 'development', 'sandbox', 'production'. +If set to 'production', the side banner is not shown. +""" + +# Invenio-Files-REST +# ================== +XROOTD_ENABLED = False +# control file download offloading +FILES_REST_STORAGE_FACTORY = storage_factory +FILES_REST_XSENDFILE_ENABLED = False +CDS_EOS_OFFLOAD_ENABLED = False +CDS_LOCAL_OFFLOAD_ENABLED = False +CDS_LOCAL_OFFLOAD_FILES = ["file.txt", "file2.txt"] +CDS_LOCAL_OFFLOAD_STORAGE = "" + +CDS_EOS_OFFLOAD_HTTPHOST = "" +# Specifies whether to use X509 authentication for EOS offload +CDS_EOS_OFFLOAD_AUTH_X509 = False +# The path to the X509 certificate file +CDS_EOS_OFFLOAD_X509_CERT_PATH = "" +# The path to the X509 private key file +CDS_EOS_OFFLOAD_X509_KEY_PATH = "" +# check nginx config for more details +CDS_EOS_OFFLOAD_REDIRECT_BASE_PATH = "" + +CDS_CERN_SCIENTIFIC_COMMUNITY_ID = "c2c46ab3-5fb4-4d86-83c6-5d9dc8392d6f" +"""The id of the CERN Scientific community.""" + +CHECKS_ENABLED = True +"""Enable metadata checks.""" + +RDM_COMMUNITY_SUBMISSION_REQUEST_CLS = checks_requests.CommunitySubmission + +RDM_COMMUNITY_INCLUSION_REQUEST_CLS = checks_requests.CommunityInclusion +# require a community when publishing +RDM_COMMUNITY_REQUIRED_TO_PUBLISH = True + +RDM_SEARCH = { + **deepcopy(RDM_SEARCH), + "query_parser_cls": QueryParser.factory( + mapping={ + "accelerator": "custom_fields.cern\:accelerators.title.en", + "accelerator.id": "custom_fields.cern\:accelerators.id", + "accelerator.title": "custom_fields.cern\:accelerators.title.en", + "accelerators": "custom_fields.cern\:accelerators.title.en", + "accelerators.id": "custom_fields.cern\:accelerators.id", + "accelerators.title": "custom_fields.cern\:accelerators.title.en", + "experiment": "custom_fields.cern\:experiments.title.en", + "experiment.id": "custom_fields.cern\:experiments.id", + "experiment.title": "custom_fields.cern\:experiments.title.en", + "experiments": "custom_fields.cern\:experiments.title.en", + "experiments.id": "custom_fields.cern\:experiments.id", + "experiments.title": "custom_fields.cern\:experiments.title.en", + "department": "custom_fields.cern\:departments.title.en", + "department.id": "custom_fields.cern\:departments.id", + "department.title": "custom_fields.cern\:departments.title.en", + "departments": "custom_fields.cern\:departments.title.en", + "departments.id": "custom_fields.cern\:departments.id", + "departments.title": "custom_fields.cern\:departments.title.en", + "programme": "custom_fields.cern\:programmes.title.en", + "programme.id": "custom_fields.cern\:programmes.id", + "programme.title": "custom_fields.cern\:programmes.title.en", + "programmes": "custom_fields.cern\:programmes.title.en", + "programmes.id": "custom_fields.cern\:programmes.id", + "programmes.title": "custom_fields.cern\:programmes.title.en", + "project": "custom_fields.cern\:projects", + "projects": "custom_fields.cern\:projects", + "study": "custom_fields.cern\:studies", + "studies": "custom_fields.cern\:studies", + }, + tree_transformer_cls=SearchFieldTransformer, + ), +} + +RDM_PERMISSION_POLICY = CDSRDMRecordPermissionPolicy + +# Static pages +APP_RDM_PAGES = { + "about": "/about", + "privacy-notice": "/privacy-notice", + "terms": "/terms", + "content-policy": "/content-policy", + "preservation-policy": "/preservation-policy", +} + +# Custom fields +RDM_NAMESPACES = { + **NAMESPACES +} +RDM_CUSTOM_FIELDS = CUSTOM_FIELDS +RDM_CUSTOM_FIELDS_UI = CUSTOM_FIELDS_UI + +# Require files for user upload +RDM_ALLOW_METADATA_ONLY_RECORDS = False + +THEME_MATHJAX_CDN = ( + "//cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js" + "?config=TeX-AMS-MML_HTMLorMML" +) + +RDM_FILES_DEFAULT_QUOTA_SIZE = 50 * 10 ** 9 # 50GB +RDM_FILES_DEFAULT_MAX_FILE_SIZE = 50 * 10 ** 9 # 50GB + +JOBS_ADMINISTRATION_ENABLED = True + +RDM_RECORDS_IDENTIFIERS_SCHEMES = { + "cdsrn": {"label": _("CDS Report Number"), + "validator": always_valid, + "datacite": "CDS"}, + "aleph": {"label": _("Aleph number"), + "validator": schemes.is_aleph, + "datacite": "ALEPH"}, + "cds": {"label": _("CDS"), + "validator": schemes.is_cds, + "datacite": "CDS" + } +} + +RDM_RECORDS_RELATED_IDENTIFIERS_SCHEMES = { + **RDM_RECORDS_RELATED_IDENTIFIERS_SCHEMES, + **{ + "inspire": { + "label": _("Inspire"), + "validator": schemes.is_inspire, + "datacite": "INSPIRE" + }, + "inis": { + "label": _("INIS"), + "validator": lambda val: str(val).isdigit(), + "datacite": "INIS" + }, + "indico": { + "label": _("Indico"), + "validator": schemes.is_indico, + "datacite": "INDICO" + }, + "hal": { + "label": "HAL", + "validator": schemes.is_hal, + "datacite": "HAL" + } + }, + # keep internal identifiers' schemes for internal record relations + **RDM_RECORDS_IDENTIFIERS_SCHEMES +} + +# Map INSPIRE Identifiers schemes to InvenioRDM ones +# Format: INSPIRE_SCHEME: INVENIO_RDM_SCHEME +CDS_INSPIRE_IDS_SCHEMES_MAPPING = { + "hdl": "handle", +} + +RDM_RECORDS_PERSONORG_SCHEMES = { + **RDM_RECORDS_PERSONORG_SCHEMES, + **{"inspire_author": {"label": _("Inspire"), + "validator": schemes.is_inspire_author, + "datacite": "INSPIRE"}, + "cds": {"label": _("CDS"), + "validator": schemes.is_cds, + "datacite": "CDS"} + } +} + +RDM_RECORDS_SERVICE_COMPONENTS = [ + SubjectsValidationComponent, + *DefaultRecordsComponents, + CDSResourcePublication, + ClcSyncComponent, + MintAlternateIdentifierComponent, +] + +### Do not require DOIs for record and parent +RDM_PERSISTENT_IDENTIFIERS["doi"]["required"] = False +RDM_PARENT_PERSISTENT_IDENTIFIERS["doi"]["required"] = False +RDM_PERSISTENT_IDENTIFIERS["doi"]["ui"][ + "default_selected"] = "not_needed" # "yes", "no" or "not_needed" + +RDM_OPTIONAL_DOI_VALIDATOR = validate_optional_doi_transitions + + +RDM_LOCK_EDIT_PUBLISHED_FILES = lock_edit_record_published_files +"""Lock editing already published files (enforce record versioning).""" + +# Invenio-requests +# ========================= + +REQUESTS_REVIEWERS_ENABLED = True +"""Enable reviewers for requests.""" + +REQUESTS_REVIEWERS_MAX_NUMBER = 15 +"""Maximum number of reviewers allowed for a request.""" + +# Invenio-Preservation-Sync +# ========================= + +PRESERVATION_SYNC_ENABLED = True + + +def resolve_record_pid(pid): + return record_service.record_cls.pid.resolve(pid).id + + +PRESERVATION_SYNC_PID_RESOLVER = resolve_record_pid + +PRESERVATION_SYNC_PERMISSION_POLICY = CDSRDMPreservationSyncPermissionPolicy + +PRESERVATION_SYNC_GET_LIST_PATH = "/records//preservations" + +PRESERVATION_SYNC_GET_LATEST_PATH = "/records//preservations/latest" + +PRESERVATION_SYNC_UI_TITLE = "CERN Digital Memory" + +PRESERVATION_SYNC_UI_INFO_LINK = "/preservation-policy" + +PRESERVATION_SYNC_UI_ICON_PATH = "images/dm_logo.png" + +APP_RDM_RECORD_LANDING_PAGE_EXTERNAL_LINKS = [ + {"id": "preservation", "render": preservation_info_render}, + {"id": "inspire", "render": inspire_link_render}, +] + +# Invenio-Previewer +# ========================= +# TODO-EV uncomment this line +# PREVIEWER_PREFERENCE = DEFAULT_PREVIEWER_PREFERENCE + [ +# "cds_rdm_gltf_previewer", +# ] + +VOCABULARIES_NAMES_SCHEMES = { + **DEFAULT_VOCABULARIES_NAMES_SCHEMES, + "inspire_author": {"label": _("Inspire"), + "validator": schemes.is_inspire_author, + "datacite": "INSPIRE"}, + "cds": {"label": _("CDS"), "validator": schemes.is_cds, "datacite": "CDS"}, +} +"""Names allowed identifier schemes.""" + +VOCABULARIES_DATASTREAM_READERS = { + **DEFAULT_VOCABULARIES_DATASTREAM_READERS, + "inspire-http-reader": InspireHTTPReader, +} +"""Data Streams readers.""" + +VOCABULARIES_DATASTREAM_TRANSFORMERS = { + **DEFAULT_VOCABULARIES_DATASTREAM_TRANSFORMERS, + "inspire-json-transformer": InspireJsonTransformer, +} +"""Data Streams transformers.""" + +VOCABULARIES_DATASTREAM_WRITERS = { + **DEFAULT_VOCABULARIES_DATASTREAM_WRITERS, + "inspire-writer": InspireWriter, +} +"""Data Streams writers.""" + +# Invenio Stats +# ============= + +# We override the templates to add new fields needed for the migrated statistic events +_APP_RDM_STATS_EVENTS["file-download"][ + "templates"] = "cds_rdm.stats.templates.events.file_download" +_APP_RDM_STATS_EVENTS["record-view"][ + "templates"] = "cds_rdm.stats.templates.events.record_view" + +# Add the yearly suffix +_APP_RDM_STATS_EVENTS["file-download"]["params"]["suffix"] = "%Y" +_APP_RDM_STATS_EVENTS["record-view"]["params"]["suffix"] = "%Y" + +# Override the index_interval to be year +_APP_RDM_STATS_AGGREGATIONS["file-download-agg"]["params"]["index_interval"] = "year" +_APP_RDM_STATS_AGGREGATIONS["record-view-agg"]["params"]["index_interval"] = "year" + +STATS_EVENTS = _APP_RDM_STATS_EVENTS +STATS_AGGREGATIONS = _APP_RDM_STATS_AGGREGATIONS + +APP_RDM_RECORD_LANDING_PAGE_TEMPLATE = "cds_rdm/records/detail.html" + +RDM_DETAIL_SIDE_BAR_MANAGE_ATTRIBUTES_EXTENSION_TEMPLATE = "cds_rdm/records/manage_menu.html" + +_RECORD_EXPORTERS = { + **RECORD_EXPORTERS, + "bibtex": { + "name": _("BibTeX (DOI for this version)"), + "serializer": ("invenio_rdm_records.resources.serializers:BibtexSerializer"), + "params": {}, + "content-type": "application/x-bibtex", + "filename": "{id}.bib", + }, + "bibtex-allversions": { + "name": _("BibTeX (DOI for all versions)"), + "serializer": ("invenio_rdm_records.resources.serializers:BibtexSerializer"), + "params": {"schema_context": {"doi_all_versions": True}}, + "content-type": "application/x-bibtex", + "filename": "{id}-allversions.bib", + }, +} +APP_RDM_RECORD_EXPORTERS = dict(sorted(_RECORD_EXPORTERS.items())) + +ADMINISTRATION_BASE_TEMPLATE = "cds_rdm/administration/admin_base_template.html" +LOGGING_CONSOLE_LEVEL = "INFO" +JOBS_LOGGING_LEVEL = "INFO" + # Not working yet CLC_SYNC_FACETS = {