mirror of https://github.com/MISP/MISP
Search for attributes by organisation
- New search functionality on request - restrict attributes by organisation - Also, attributes in the list attributes and search attributes result pages, that belong to the user's organisation will have a red event IDpull/64/merge
parent
ef93e61efb
commit
f008eb9f07
|
@ -742,6 +742,7 @@ class AttributesController extends AppController {
|
|||
if ($this->request->is('post') && ($this->request->here == $fullAddress)) {
|
||||
$keyword = $this->request->data['Attribute']['keyword'];
|
||||
$keyword2 = $this->request->data['Attribute']['keyword2'];
|
||||
$org = $this->request->data['Attribute']['org'];
|
||||
$type = $this->request->data['Attribute']['type'];
|
||||
$category = $this->request->data['Attribute']['category'];
|
||||
$this->set('keywordSearch', $keyword);
|
||||
|
@ -752,6 +753,8 @@ class AttributesController extends AppController {
|
|||
$this->set('categorySearch', $category);
|
||||
// search the db
|
||||
$conditions = array();
|
||||
|
||||
// search on the value field
|
||||
if (isset($keyword)) {
|
||||
$keywordArray = preg_split("/\r\n|\n|\r/", $keyword);
|
||||
$i = 1;
|
||||
|
@ -774,6 +777,8 @@ class AttributesController extends AppController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// event IDs to be excluded
|
||||
if (isset($keyword2)) {
|
||||
$keywordArray2 = preg_split("/\r\n|\n|\r/", $keyword2);
|
||||
$i = 1;
|
||||
|
@ -802,13 +807,18 @@ class AttributesController extends AppController {
|
|||
if ($category != 'ALL') {
|
||||
$conditions['Attribute.category ='] = $category;
|
||||
}
|
||||
// organisation search field
|
||||
if (isset($org) && $org != '') {
|
||||
$org = trim($org);
|
||||
$this->set('orgSearch', $org);
|
||||
$conditions['Event.orgc ='] = $org;
|
||||
}
|
||||
$this->Attribute->recursive = 0;
|
||||
$this->paginate = array(
|
||||
'limit' => 60,
|
||||
'maxLimit' => 9999, // LATER we will bump here on a problem once we have more than 9999 attributes?
|
||||
'conditions' => $conditions
|
||||
);
|
||||
|
||||
if ('true' == Configure::read('CyDefSIG.private')) {
|
||||
if (!$this->_IsSiteAdmin()) {
|
||||
// merge in private conditions
|
||||
|
|
|
@ -7,6 +7,7 @@ if ($isSearch == 1) {
|
|||
if ($keywordSearch2 != null) echo " excluding the events \"<b>" . h($keywordSearch2) . "</b>\"";
|
||||
if ($categorySearch != "ALL") echo " of category \"<b>" . h($categorySearch) . "</b>\"";
|
||||
if ($typeSearch != "ALL") echo " of type \"<b>" . h($typeSearch) . "</b>\"";
|
||||
if (isset($orgSearch) && $orgSearch != '' && $orgSearch != null) echo " created by the organisation \"<b>" . h($orgSearch) . "</b>\"";
|
||||
echo ":</h4>";
|
||||
} ?>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
|
@ -27,7 +28,11 @@ foreach ($attributes as $attribute):
|
|||
<td class="short">
|
||||
<?php
|
||||
echo "<div id = \"" . $attribute['Attribute']['id'] . "\" title = \"".h($attribute['Event']['info'])."\">";
|
||||
echo $this->Html->link($attribute['Event']['id'], array('controller' => 'events', 'action' => 'view', $attribute['Event']['id']));
|
||||
if ($attribute['Event']['orgc'] == $me['org']) {
|
||||
echo $this->Html->link($attribute['Event']['id'], array('controller' => 'events', 'action' => 'view', $attribute['Event']['id']), array('class' => 'SameOrgLink'));
|
||||
} else {
|
||||
echo $this->Html->link($attribute['Event']['id'], array('controller' => 'events', 'action' => 'view', $attribute['Event']['id']));
|
||||
}
|
||||
$currentCount++;
|
||||
?>
|
||||
</td>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<?php
|
||||
echo $this->Form->input('keyword', array('type' => 'textarea', 'label' => 'Containing the following expressions'));
|
||||
echo $this->Form->input('keyword2', array('type' => 'textarea', 'label' => 'Excluding the following events'));
|
||||
echo $this->Form->input('org', array('type' => 'text', 'label' => 'From the following organisation'));
|
||||
echo $this->Form->input('type', array('between' => $this->Html->div('forminfo', '', array('id' => 'AttributeTypeDiv'))));
|
||||
echo $this->Form->input('category', array('between' => $this->Html->div('forminfo', '', array('id' => 'AttributeCategoryDiv'))));
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue