Skip to content

Commit

Permalink
new: [settings:inbox.data_change_notify_for_all] Added setting to be …
Browse files Browse the repository at this point in the history
…more verbose for data changes
  • Loading branch information
mokaddem committed Dec 13, 2023
1 parent eefe6b2 commit ecc421b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Model/Behavior/NotifyAdminsBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ public function afterDelete(EventInterface $event, EntityInterface $entity, Arra
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;
Expand Down
15 changes: 14 additions & 1 deletion src/Model/Table/SettingProviders/CerebrateSettingsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,20 @@ protected function generateSettingsConfiguration()
],
]
]
]
],
'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' => [
Expand Down

0 comments on commit ecc421b

Please sign in to comment.