mirror of https://github.com/MISP/MISP
chg: [internal] Small controller cleanup
parent
26d9cba4a9
commit
fa222e76f1
|
@ -71,7 +71,8 @@ class AttributesController extends AppController
|
|||
'AttributeTag' => array('Tag'),
|
||||
'Object' => array(
|
||||
'fields' => array('Object.id', 'Object.distribution', 'Object.sharing_group_id')
|
||||
)
|
||||
),
|
||||
'SharingGroup' => ['fields' => ['SharingGroup.name']],
|
||||
);
|
||||
$this->Attribute->contain(array('AttributeTag' => array('Tag')));
|
||||
$this->set('isSearch', 0);
|
||||
|
@ -82,20 +83,12 @@ class AttributesController extends AppController
|
|||
}
|
||||
return $this->RestResponse->viewData($attributes, $this->response->type());
|
||||
}
|
||||
$org_ids = array();
|
||||
$orgs = $this->Attribute->Event->Orgc->find('list', array(
|
||||
'conditions' => array('Orgc.id' => $org_ids),
|
||||
'fields' => array('Orgc.id', 'Orgc.name')
|
||||
list($attributes, $sightingsData) = $this->__searchUI($attributes);
|
||||
$this->set('sightingsData', $sightingsData);
|
||||
$orgTable = $this->Attribute->Event->Orgc->find('list', array(
|
||||
'fields' => array('Orgc.id', 'Orgc.name')
|
||||
));
|
||||
if (!$this->_isRest()) {
|
||||
$temp = $this->__searchUI($attributes);
|
||||
$this->loadModel('Galaxy');
|
||||
$this->set('mitreAttackGalaxyId', $this->Galaxy->getMitreAttackGalaxyId());
|
||||
$attributes = $temp[0];
|
||||
$sightingsData = $temp[1];
|
||||
$this->set('sightingsData', $sightingsData);
|
||||
}
|
||||
$this->set('orgs', $orgs);
|
||||
$this->set('orgTable', $orgTable);
|
||||
$this->set('shortDist', $this->Attribute->shortDist);
|
||||
$this->set('attributes', $attributes);
|
||||
$this->set('attrDescriptions', $this->Attribute->fieldDescriptions);
|
||||
|
@ -1744,7 +1737,8 @@ class AttributesController extends AppController
|
|||
'AttributeTag' => array('Tag'),
|
||||
'Object' => array(
|
||||
'fields' => array('Object.id', 'Object.distribution', 'Object.sharing_group_id')
|
||||
)
|
||||
),
|
||||
'SharingGroup' => ['fields' => ['SharingGroup.name']],
|
||||
);
|
||||
$attributes = $this->paginate();
|
||||
if (!$this->_isRest()) {
|
||||
|
@ -1805,6 +1799,10 @@ class AttributesController extends AppController
|
|||
$attributes[$k] = $attribute;
|
||||
}
|
||||
|
||||
if ($attribute['Attribute']['distribution'] == 4) {
|
||||
$attributes[$k]['Attribute']['SharingGroup'] = $attribute['SharingGroup'];
|
||||
}
|
||||
|
||||
$attributes[$k]['Attribute']['AttributeTag'] = $attributes[$k]['AttributeTag'];
|
||||
$attributes[$k]['Attribute'] = $this->Attribute->Event->massageTags($attributes[$k]['Attribute'], 'Attribute', $excludeGalaxy = false, $cullGalaxyTags = true);
|
||||
unset($attributes[$k]['AttributeTag']);
|
||||
|
|
|
@ -1130,6 +1130,7 @@ class EventsController extends AppController
|
|||
}
|
||||
$conditions['includeAllTags'] = true;
|
||||
$conditions['includeGranularCorrelations'] = 1;
|
||||
$conditions['includeEventCorrelations'] = false;
|
||||
if (!empty($filters['includeRelatedTags'])) {
|
||||
$this->set('includeRelatedTags', 1);
|
||||
$conditions['includeRelatedTags'] = 1;
|
||||
|
@ -1266,9 +1267,12 @@ class EventsController extends AppController
|
|||
$this->set('advancedFilteringActive', $advancedFiltering['active'] ? 1 : 0);
|
||||
$this->set('advancedFilteringActiveRules', $advancedFiltering['activeRules']);
|
||||
$this->set('defaultFilteringRules', $this->defaultFilteringRules);
|
||||
$orgTable = $this->Event->Orgc->find('list', array(
|
||||
'fields' => array('Orgc.id', 'Orgc.name')
|
||||
));
|
||||
$this->set('orgTable', $orgTable);
|
||||
$this->disableCache();
|
||||
$this->layout = 'ajax';
|
||||
$this->loadModel('Sighting');
|
||||
$uriArray = explode('/', $this->params->here);
|
||||
foreach ($uriArray as $k => $v) {
|
||||
if (strpos($v, ':')) {
|
||||
|
@ -1282,7 +1286,6 @@ class EventsController extends AppController
|
|||
if (!empty($filters['includeSightingdb']) && Configure::read('Plugin.Sightings_sighting_db_enable')) {
|
||||
$this->set('sightingdbs', $this->Sightingdb->getSightingdbList($this->Auth->user()));
|
||||
}
|
||||
$this->set('sightingTypes', $this->Sighting->type);
|
||||
$this->set('currentUri', $this->params->here);
|
||||
$this->layout = false;
|
||||
$this->render('/Elements/eventattribute');
|
||||
|
@ -1525,8 +1528,6 @@ class EventsController extends AppController
|
|||
}
|
||||
$this->set('contributors', $contributors);
|
||||
$this->set('typeGroups', array_keys($this->Event->Attribute->typeGroupings));
|
||||
$this->loadModel('Sighting');
|
||||
$this->set('sightingTypes', $this->Sighting->type);
|
||||
$attributeUri = '/events/viewEventAttributes/' . $event['Event']['id'];
|
||||
foreach ($this->params->named as $k => $v) {
|
||||
if (!is_numeric($k)) {
|
||||
|
|
Loading…
Reference in New Issue