Allow a notification to bypass the content access check

Created on 6 February 2024, 11 months ago
Updated 26 June 2024, 6 months ago

Problem/Motivation

We have email notifications that need to go out to group email addresses. These addresses aren't necessarily registered users, but emails sent to them land in authorised users' inboxes.

The module currently doesn't allow notifications to be sent to these addresses if the content is unpublished.

Steps to reproduce

- Ensure anonymous users do not have access to view unpublished content
- Set up a notification to be sent for an unpublished node
- Set an adhoc email address that isn't registered on the website
- Trigger the notification

Result: notification isn't sent to the un-registered address

Proposed resolution

Allow an option on notification to bypass the access check. Add a warning message to this option.

Remaining tasks

Review patch.

User interface changes

New option "Bypass access check" when creating/editing a notification.

API changes

N/A

Data model changes

New field 'bypass_access_check' in notifications.

Feature request
Status

Needs review

Version

3.6

Component

Code

Created by

🇬🇧United Kingdom khaled.zaidan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @khaled.zaidan
  • 🇬🇧United Kingdom khaled.zaidan

    Patch attached.

  • Status changed to Needs review 11 months ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update 11 months ago
    Patch Failed to Apply
  • 🇳🇿New Zealand hitfactory

    +1 for this idea.

    In our case, we need to send a thank you email to anonymous users without any links so the access check shouldn't even need to run.

    I applied the patch on a new site with the module and the new configuration property bypass_anonymous_access was saved on the notification configuration entity, but on an existing site, it doesn't seem to persist.

    Perhaps an update hook is also required to add the property and set it to false on existing notifications?

Production build 0.71.5 2024