Merge branch 'develop' of github.com:MISP/MISP into feature-workflows-2

pull/8530/head
Sami Mokaddem 2022-08-02 11:31:12 +02:00
commit 3a65f22ada
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
6 changed files with 36 additions and 15 deletions

View File

@ -1470,7 +1470,7 @@ class AttributesController extends AppController
return new CakeResponse(array('body'=> json_encode(array('saved' => true)), 'status' => 200, 'type' => 'json'));
}
private function __getSearchFilters()
private function __getSearchFilters(&$exception)
{
if (isset($this->request->data['Attribute'])) {
$this->request->data = $this->request->data['Attribute'];
@ -1524,7 +1524,8 @@ class AttributesController extends AppController
public function search($continue = false)
{
$filters = $this->__getSearchFilters();
$exception = null;
$filters = $this->__getSearchFilters($exception);
if ($this->request->is('post') || !empty($this->request->params['named']['tags'])) {
if ($filters === false) {
return $exception;
@ -1552,7 +1553,7 @@ class AttributesController extends AppController
$this->Session->write('search_attributes_filters', null);
}
if (isset($filters)) {
if (!empty($filters)) {
$filters['includeCorrelations'] = 1;
$params = $this->Attribute->restSearch($this->Auth->user(), 'json', $filters, true);
if (!isset($params['conditions']['Attribute.deleted'])) {

View File

@ -98,6 +98,7 @@ class ACLComponent extends Component
],
'correlations' => [
'generateTopCorrelations' => [],
'overCorrelations' => [],
'top' => []
],
'cryptographicKeys' => [

View File

@ -102,6 +102,7 @@ class CorrelationsController extends AppController
if ($this->_isRest()) {
return $this->RestResponse->viewData($data, 'json');
} else {
$this->__setPagingParams($query['page'], $query['limit'], count($data), 'named');
$this->set('data', $data);
$this->set('title_for_layout', __('Index of over correlating values'));
$this->set('menuData', [

View File

@ -363,7 +363,18 @@ class DefaultCorrelationBehavior extends ModelBehavior
if (!empty($includeEventData)) {
$contain['Event'] = [
'fields' => [
'Event.id', 'Event.uuid', 'Event.info', 'Event.distribution', 'Event.sharing_group_id', 'Event.date', 'Event.orgc_id', 'Event.org_id'
'Event.id',
'Event.uuid',
'Event.threat_level_id',
'Event.analysis',
'Event.info',
'Event.extends_uuid',
'Event.distribution',
'Event.sharing_group_id',
'Event.published',
'Event.date',
'Event.orgc_id',
'Event.org_id'
]
];
}
@ -379,10 +390,7 @@ class DefaultCorrelationBehavior extends ModelBehavior
$results = [];
foreach ($relatedAttributes as $k => $attribute) {
$temp = $attribute['Attribute'];
$temp['info'] = $attribute['Event']['info'];
$temp['org_id'] = $attribute['Event']['org_id'];
$temp['id'] = $attribute['Event']['id'];
$temp['date'] = $attribute['Event']['date'];
$temp['Event'] = $attribute['Event'];
$results[] = $temp;
}
return $results;
@ -455,8 +463,10 @@ class DefaultCorrelationBehavior extends ModelBehavior
private function checkCorrelationACL($user, $correlation, $sgids, $prefix)
{
// check if user can see the event
if (isset($correlation['Correlation'])) {
$correlation = $correlation['Correlation'];
}
if (
$correlation[$prefix . 'org_id'] != $user['org_id'] &&
(

View File

@ -268,7 +268,18 @@ class NoAclCorrelationBehavior extends ModelBehavior
if (!empty($includeEventData)) {
$contain['Event'] = [
'fields' => [
'Event.id', 'Event.uuid', 'Event.info', 'Event.distribution', 'Event.sharing_group_id', 'Event.date', 'Event.orgc_id', 'Event.org_id'
'Event.id',
'Event.uuid',
'Event.threat_level_id',
'Event.analysis',
'Event.info',
'Event.extends_uuid',
'Event.distribution',
'Event.sharing_group_id',
'Event.published',
'Event.date',
'Event.orgc_id',
'Event.org_id'
]
];
}
@ -284,10 +295,7 @@ class NoAclCorrelationBehavior extends ModelBehavior
$results = [];
foreach ($relatedAttributes as $k => $attribute) {
$temp = $attribute['Attribute'];
$temp['info'] = $attribute['Event']['info'];
$temp['org_id'] = $attribute['Event']['org_id'];
$temp['id'] = $attribute['Event']['id'];
$temp['date'] = $attribute['Event']['date'];
$temp['Event'] = $attribute['Event'];
$results[] = $temp;
}
return $results;

View File

@ -2,7 +2,7 @@
echo sprintf('<div%s>', empty($ajax) ? ' class="index"' : '');
echo $this->element('genericElements/IndexTable/index_table', [
'data' => [
'stupid_pagination' => 1,
'light_paginator' => 1,
'data' => $data,
'top_bar' => [
'children' => [