Skip to content

Commit

Permalink
Merge pull request #237 from M3nin0/dev
Browse files Browse the repository at this point in the history
checker: support for allowed emails
  • Loading branch information
M3nin0 authored Dec 3, 2024
2 parents ab16909 + 994a630 commit 0e2b34f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions geo_rdm_records/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
# =======
Expand Down
9 changes: 8 additions & 1 deletion geo_rdm_records/modules/checker/base/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e2b34f

Please sign in to comment.