mirror of https://github.com/MISP/MISP
Merge pull request #7579 from JakubOnderka/publish_alerts_summary_only_deprecate
chg: [alert] Deprecate `MISP.publish_alerts_summary_only`pull/7740/head
commit
a539b2ee7c
|
@ -32,9 +32,11 @@ class EventShell extends AppShell
|
|||
));
|
||||
$parser->addSubcommand('testEventNotificationEmail', [
|
||||
'help' => __('Generate event notification email in EML format.'),
|
||||
'arguments' => [
|
||||
'event_id' => ['help' => __('Event ID'), 'required' => true],
|
||||
'user_id' => ['help' => __('User ID'), 'required' => true],
|
||||
'parser' => [
|
||||
'arguments' => [
|
||||
'event_id' => ['help' => __('Event ID'), 'required' => true],
|
||||
'user_id' => ['help' => __('User ID'), 'required' => true],
|
||||
],
|
||||
],
|
||||
]);
|
||||
$parser->addSubcommand('duplicateTags', [
|
||||
|
@ -544,7 +546,7 @@ class EventShell extends AppShell
|
|||
'includeEventCorrelations' => true,
|
||||
'noEventReports' => true,
|
||||
'noSightings' => true,
|
||||
'metadata' => Configure::read('MISP.event_alert_metadata_only') ?: false,
|
||||
'metadata' => Configure::read('MISP.event_alert_metadata_only') || Configure::read('MISP.publish_alerts_summary_only'),
|
||||
]);
|
||||
if (empty($eventForUser)) {
|
||||
$this->error("Event with ID $eventId not exists or given user don't have permission to access it.");
|
||||
|
|
|
@ -3229,6 +3229,7 @@ class Event extends AppModel
|
|||
|
||||
$userCount = count($usersWithAccess);
|
||||
$this->UserSetting = ClassRegistry::init('UserSetting');
|
||||
$metadataOnly = Configure::read('MISP.event_alert_metadata_only') || Configure::read('MISP.publish_alerts_summary_only');
|
||||
foreach ($usersWithAccess as $k => $user) {
|
||||
// Fetch event for user that will receive alert e-mail to respect all ACLs
|
||||
$eventForUser = $this->fetchEvent($user, [
|
||||
|
@ -3237,7 +3238,7 @@ class Event extends AppModel
|
|||
'includeEventCorrelations' => true,
|
||||
'noEventReports' => true,
|
||||
'noSightings' => true,
|
||||
'metadata' => Configure::read('MISP.event_alert_metadata_only') ?: false,
|
||||
'metadata' => $metadataOnly,
|
||||
])[0];
|
||||
|
||||
if ($this->UserSetting->checkPublishFilter($user, $eventForUser)) {
|
||||
|
@ -3284,11 +3285,7 @@ class Event extends AppModel
|
|||
$subjMarkingString = $this->getEmailSubjectMarkForEvent($event);
|
||||
$subject = "[" . Configure::read('MISP.org') . " MISP] Event {$event['Event']['id']} - $subject$threatLevel" . strtoupper($subjMarkingString);
|
||||
|
||||
if (!empty(Configure::read('MISP.publish_alerts_summary_only'))) {
|
||||
$template = new SendEmailTemplate('alert_light');
|
||||
} else {
|
||||
$template = new SendEmailTemplate('alert');
|
||||
}
|
||||
$template = new SendEmailTemplate('alert');
|
||||
$template->set('event', $event);
|
||||
$template->set('user', $user);
|
||||
$template->set('oldPublishTimestamp', $oldpublish);
|
||||
|
|
|
@ -5009,7 +5009,7 @@ class Server extends AppModel
|
|||
),
|
||||
'publish_alerts_summary_only' => array(
|
||||
'level' => 1,
|
||||
'description' => __('Only send a summary of the publish alert, rather than the full contents of the event.'),
|
||||
'description' => __('This setting is deprecated. Please use `MISP.event_alert_metadata_only` instead.'),
|
||||
'value' => false,
|
||||
'errorMessage' => '',
|
||||
'null' => true,
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
if (!isset($oldPublishTimestamp)) {
|
||||
$oldPublishTimestamp = null;
|
||||
}
|
||||
|
||||
if (!isset($contactAlert)) {
|
||||
$contactAlert = false;
|
||||
}
|
||||
|
||||
if ($hideDetails) { // Used when GnuPG.bodyonlyencrypted is enabled and e-mail cannot be send in encrypted form
|
||||
$eventUrl = $baseurl . "/events/view/" . $event['Event']['id'];
|
||||
echo __("A new or modified event was just published on %s", $eventUrl) . PHP_EOL . PHP_EOL;
|
||||
echo __("If you would like to unsubscribe from receiving such alert e-mails, simply\ndisable publish alerts via %s", $baseurl . '/users/edit');
|
||||
return;
|
||||
}
|
||||
|
||||
$tags = [];
|
||||
foreach ($event['EventTag'] as $tag) {
|
||||
$tags[] = $tag['Tag']['name'];
|
||||
}
|
||||
?>
|
||||
==============================================
|
||||
URL : <?= $baseurl ?>/events/view/<?= $event['Event']['id'] . PHP_EOL ?>
|
||||
Event ID : <?= $event['Event']['id'] . PHP_EOL ?>
|
||||
Date : <?= $event['Event']['date'] . PHP_EOL ?>
|
||||
<?php if (Configure::read('MISP.showorg')): ?>
|
||||
Reported by : <?= $event['Orgc']['name'] . PHP_EOL ?>
|
||||
Local owner of the event : <?= $event['Org']['name'] . PHP_EOL ?>
|
||||
<?php endif; ?>
|
||||
Distribution: <?= $distributionLevels[$event['Event']['distribution']] . PHP_EOL ?>
|
||||
<?php if ($event['Event']['distribution'] == 4): ?>
|
||||
Sharing Group: <?= $event['SharingGroup']['name'] . PHP_EOL ?>
|
||||
<?php endif; ?>
|
||||
Tags: <?= implode(", ", $tags) . PHP_EOL ?>
|
||||
Threat Level: <?= $event['ThreatLevel']['name'] . PHP_EOL ?>
|
||||
Analysis : <?= $analysisLevels[$event['Event']['analysis']] . PHP_EOL ?>
|
||||
Description : <?= $event['Event']['info'] . PHP_EOL ?>
|
||||
<?php if (!empty($event['RelatedEvent'])): ?>
|
||||
==============================================
|
||||
Related to:
|
||||
<?php
|
||||
foreach ($event['RelatedEvent'] as $relatedEvent) {
|
||||
echo $baseurl . '/events/view/' . $relatedEvent['Event']['id'] . ' (' . $relatedEvent['Event']['date'] . ') ' . "\n";
|
||||
}
|
||||
?>
|
||||
==============================================
|
||||
<?php endif; ?>
|
||||
|
||||
Publish alerts are configured to include summaries only, for the detailed contents, please view the event in MISP directly.
|
||||
|
||||
==============================================
|
||||
You receive this e-mail because the e-mail address <?= $user['email'] ?> is set
|
||||
to receive <?= $contactAlert ? 'contact' : 'publish' ?> alerts on the MISP instance at <?= $baseurl ?>.
|
||||
|
||||
If you would like to unsubscribe from receiving such alert e-mails, simply
|
||||
disable <?= $contactAlert ? 'contact' : 'publish' ?> alerts via <?= $baseurl ?>/users/edit
|
||||
==============================================
|
Loading…
Reference in New Issue