Merge branch 'develop' of github.com:MISP/MISP into develop

feature/event-view-collapsible-objects
iglocska 2024-05-16 11:42:43 +02:00
commit c1d9c27dd1
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
4 changed files with 27 additions and 7 deletions

View File

@ -155,8 +155,14 @@ class AuditLogsController extends AppController
$this->set('title_for_layout', __('Audit logs'));
}
public function eventIndex($eventId, $org = null)
public function eventIndex($eventId = null, $org = null)
{
$params = $this->IndexFilter->harvestParameters(['created', 'org', 'eventId']);
if (!empty($params['eventId'])) {
$eventId = $params['eventId'];
} else if (empty($eventId)) {
$eventId = -1;
}
$event = $this->AuditLog->Event->fetchSimpleEvent($this->Auth->user(), $eventId);
if (empty($event)) {
throw new NotFoundException('Invalid event.');
@ -164,7 +170,6 @@ class AuditLogsController extends AppController
$this->paginate['conditions'] = $this->__createEventIndexConditions($event);
$this->set('passedArgsArray', ['eventId' => $eventId, 'org' => $org]);
$params = $this->IndexFilter->harvestParameters(['created', 'org']);
if ($org) {
$params['org'] = $org;
}

View File

@ -199,7 +199,9 @@ class EventReport extends AppModel
$errors = $this->saveAndReturnErrors($report, ['fieldList' => self::CAPTURE_FIELDS], $errors);
if (empty($errors)) {
$this->Event->captureAnalystData($user, $report['EventReport'], 'EventReport', $report['EventReport']['uuid']);
$this->Event->unpublishEvent($eventId);
if (!$fromPull) {
$this->Event->unpublishEvent($eventId);
}
}
return $errors;
}

View File

@ -38,6 +38,17 @@ class Relationship extends AnalystData
/** @var array|null */
private $__currentUser;
public function beforeValidate($options = array())
{
parent::beforeValidate($options);
// Prevent self-referencing relationships
if ($this->data[$this->current_type]['object_uuid'] == $this->data[$this->current_type]['related_object_uuid']) {
return false;
}
return true;
}
public function afterFind($results, $primary = false)
{
$results = parent::afterFind($results, $primary);

View File

@ -67,13 +67,14 @@ if (isset($interpolation) && !empty($interpolation)) {
<ul id="attack-matrix-tabscontroller" class="nav nav-tabs" style="margin-bottom: 2px;">
<?php
if (!isset($defaultTabName)) {
reset($tabs);
$defaultTabName = key($tabs); // get first key
reset($columnOrders);
$defaultTabName = key($columnOrders); // get first key
}
if (empty($static)):
foreach($tabs as $tabName => $column):
foreach(array_keys($columnOrders) as $tabName):
?>
<?php $column = $tabs[$tabName]; ?>
<li class="tactic <?php echo $tabName==$defaultTabName ? "active" : ""; ?>"><span href="#tabMatrix-<?php echo h($tabName); ?>" data-toggle="tab" style="padding-top: 3px; padding-bottom: 3px;"><?php echo h($tabName); ?></span></li>
<?php endforeach; ?>
<?php endif; ?>
@ -125,7 +126,8 @@ foreach($tabs as $tabName => $column):
<div id="matrix_container" class="fixed-table-container-inner" style="" data-picking-mode="<?php echo $pickingMode ? 'true' : 'false'; ?>">
<div class="tab-content">
<?php foreach($tabs as $tabName => $column): ?>
<?php foreach(array_keys($columnOrders) as $tabName): ?>
<?php $column = $tabs[$tabName]; ?>
<?php
if (!empty($static) && $tabName != $defaultTabName) {
// We cannot hide other tabs without JS. Only releave the default one for now.