diff --git a/geo_rdm_records/config.py b/geo_rdm_records/config.py index 8514097..15691d0 100644 --- a/geo_rdm_records/config.py +++ b/geo_rdm_records/config.py @@ -219,6 +219,8 @@ GEO_RDM_CHECKER_OUTDATED_CRITERIA = 6 * 365 / 12 """Criteria used to set if a record is outdated.""" +GEO_RDM_CHECKER_ALLOWED_EMAILS = [] +"""Owners that can receive emails from checker (If empty, all owner are allowed).""" # OAI-PMH # ======= diff --git a/geo_rdm_records/modules/checker/base/report.py b/geo_rdm_records/modules/checker/base/report.py index 81ca194..5ae8e9b 100644 --- a/geo_rdm_records/modules/checker/base/report.py +++ b/geo_rdm_records/modules/checker/base/report.py @@ -34,7 +34,14 @@ def _check_owner_can_receive_report(owner_profile): is_active = owner_profile["active"] is_email_confirmed = owner_profile["confirmed"] - return is_active and is_email_confirmed + # Extra property: The owner is eligible to receive emails from Checkers. + is_authorized = True + authorized_owners = current_app.config.get("GEO_RDM_CHECKER_ALLOWED_EMAILS", []) + + if authorized_owners: + is_authorized = owner_profile["email"] in authorized_owners + + return is_active and is_email_confirmed and is_authorized def _build_report_message( diff --git a/setup.cfg b/setup.cfg index b3a6e62..06814cd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,6 +37,7 @@ install_requires = datacite<=1.1.4 pydash>=7.0.6 requests>=2.28.2 + sentry-sdk<=2.19.0 retry-requests>=2.0.0,<2.1.0 requests-cache>=1.1.0,<1.2.0 invenio-i18n>=1.2.0