Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:MISP/MISP into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
iglocska committed May 16, 2024
2 parents 8dc58f3 + d346b6c commit c1d9c27
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
9 changes: 7 additions & 2 deletions app/Controller/AuditLogsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,21 @@ public function admin_index()
$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.');
}
$this->paginate['conditions'] = $this->__createEventIndexConditions($event);
$this->set('passedArgsArray', ['eventId' => $eventId, 'org' => $org]);

$params = $this->IndexFilter->harvestParameters(['created', 'org']);
if ($org) {
$params['org'] = $org;
}
Expand Down
4 changes: 3 additions & 1 deletion app/Model/EventReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ public function editReport(array $user, array $report, $eventId, $fromPull = fal
$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;
}
Expand Down
11 changes: 11 additions & 0 deletions app/Model/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions app/View/Elements/view_galaxy_matrix.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -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; ?>
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit c1d9c27

Please sign in to comment.