Add the ability to skip the access check for specific message before sending an emailtemplates

Created on 29 October 2024, about 1 month ago

Problem/Motivation

Sometimes we need to send a notification about an entity to a user who does not have access for that entity

For example, we want to notify a user that their request to join a group has been rejected. Here, the related entity is group_membership_request, however, the user does not have access to view operation in this case.

Proposed resolution

Initialize an array for message bundles for which related entity access checks will be skipped, and give possibility to alter this array using a hook

$message_template_bundles = [];

$this->moduleHandler->alter('activity_send_email_template_access', $message_template_bundles);

// Only for users that have access to related content,
// if it's not a specific message template.
if (in_array($parameters['message']->bundle(), $message_template_bundles) || $parameters['activity']->getRelatedEntity()->access('view', $target_account)) {

?>
?>

✨ Feature request
Status

Needs work

Version

13.0

Component

Code (back-end)

Created by

πŸ‡ΊπŸ‡¦Ukraine v.koval

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

Comments & Activities

Production build 0.71.5 2024