new: [settings:inbox.data_change_notify_for_all] Added setting to be more verbose for data changes

refacto/CRUDComponent
Sami Mokaddem 2023-12-13 15:01:23 +01:00
parent eefe6b22cc
commit ecc421b326
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 18 additions and 2 deletions

View File

@ -73,7 +73,10 @@ class NotifyAdminsBehavior extends Behavior
public function isNotificationAllowed(EventInterface $event, EntityInterface $entity, ArrayObject $options): bool
{
$loggedUser = Configure::read('loggedUser');
if (empty($loggedUser) || !empty($loggedUser['role']['perm_admin']) || !empty($loggedUser['role']['perm_sync'])) {
if (
empty(Configure::read('inbox.data_change_notify_for_all', false)) &&
(empty($loggedUser) || !empty($loggedUser['role']['perm_admin']) || !empty($loggedUser['role']['perm_sync']))
) {
return false;
}
return true;

View File

@ -351,7 +351,20 @@ class CerebrateSettingsProvider extends BaseSettingsProvider
],
]
]
]
],
'Inbox' => [
'Data change notification' => [
'Data change notification' => [
'inbox.data_change_notify_for_all' => [
'name' => __('Notify data modification for all Users'),
'type' => 'boolean',
'description' => __('Turning this option ON will alert administrators whenever data is modified, irrespective of the user\'s role responsible for the modification.'),
'default' => false,
'severity' => 'warning',
],
],
],
],
/*
'Features' => [
'Demo Settings' => [