* EPL/Mail/SpamTitan: allow admins to white- or blacklist for all users / whole domain

This commit is contained in:
ralf 2024-10-29 13:33:11 +01:00
parent 6b24c1f7c2
commit 014d953d35
4 changed files with 21 additions and 3 deletions

View File

@ -1077,7 +1077,24 @@ class mail_ui
// spamTitan actions // spamTitan actions
if (($account->acc_spam_api || !empty($account->getParamOverwrites()['acc_spam_api'])) && class_exists('stylite_mail_spamtitan')) if (($account->acc_spam_api || !empty($account->getParamOverwrites()['acc_spam_api'])) && class_exists('stylite_mail_spamtitan'))
{ {
$actions['spamfilter']['children'] = array_merge($actions['spamfilter']['children'], stylite_mail_spamtitan::getActions()); $actions['spamfilter']['children'] = array_merge($actions['spamfilter']['children'], $spam_actions=stylite_mail_spamtitan::getActions());
// allow EGroupware admins to white- or blacklist for everyone/whole domain
if (!empty($GLOBALS['egw_info']['apps']['admin']))
{
foreach($spam_actions as $id => $action)
{
$children = [];
foreach($action['children'] as $child_id => $child)
{
$children[$child_id.'_all'] = $child;
}
$actions['spamfilter']['children'][$id.'_all'] = [
'caption' => lang('%1 for all users', $action['caption']),
'children' => $children,
]+$action;
}
}
} }
return $actions; return $actions;
} }

View File

@ -5724,7 +5724,7 @@ app.classes.mail = AppJS.extend(
email = (fromaddress && fromaddress[1]) ?fromaddress[1]:data.data.fromaddress; email = (fromaddress && fromaddress[1]) ?fromaddress[1]:data.data.fromaddress;
domain = email.split('@')[1]; domain = email.split('@')[1];
} }
switch (_action.id) switch (_action.id.replace(/_all$/, ''))
{ {
case 'whitelist_email_add': case 'whitelist_email_add':
_action.set_caption(this.egw.lang('Add "%1" into whitelisted emails', email)); _action.set_caption(this.egw.lang('Add "%1" into whitelisted emails', email));
@ -5750,7 +5750,6 @@ app.classes.mail = AppJS.extend(
case 'blacklist_domain_remove': case 'blacklist_domain_remove':
_action.set_caption(this.egw.lang('Remove "%1" from blacklisted domains', domain)); _action.set_caption(this.egw.lang('Remove "%1" from blacklisted domains', domain));
break; break;
} }
return true; return true;

View File

@ -1,4 +1,5 @@
%1 attachments mail de %1 Anhänge %1 attachments mail de %1 Anhänge
%1 for all users mail de %1 für alle Benutzer
%1 has been added to blacklisted email addresses mail de %1 wurde als E-Mail-Adresse zur Blacklist hinzugefügt %1 has been added to blacklisted email addresses mail de %1 wurde als E-Mail-Adresse zur Blacklist hinzugefügt
%1 has been added to whiltelisted email addresses mail de %1 wurde als E-Mail-Adresse zur Whitelist hinzugefügt %1 has been added to whiltelisted email addresses mail de %1 wurde als E-Mail-Adresse zur Whitelist hinzugefügt
%1 has been removed from blacklisted email addresses mail de %1 wurde als E-Mail-Adresse von der Blacklist entfernt %1 has been removed from blacklisted email addresses mail de %1 wurde als E-Mail-Adresse von der Blacklist entfernt

View File

@ -1,4 +1,5 @@
%1 attachments mail en %1 attachments %1 attachments mail en %1 attachments
%1 for all users mail en %1 for all users
%1 has been added to blacklisted email addresses mail en %1 has been added to blacklisted email addresses %1 has been added to blacklisted email addresses mail en %1 has been added to blacklisted email addresses
%1 has been added to whiltelisted email addresses mail en %1 has been added to whiltelisted email addresses %1 has been added to whiltelisted email addresses mail en %1 has been added to whiltelisted email addresses
%1 has been removed from blacklisted email addresses mail en %1 has been removed from blacklisted email addresses %1 has been removed from blacklisted email addresses mail en %1 has been removed from blacklisted email addresses