mirror of https://github.com/MISP/MISP
new: [API] set default behaviour to require to_ids and published set to 1 to be included in exports
- doesn't affect MISP json and xml formatspull/3626/head
parent
2fdeebd209
commit
289b13be88
|
@ -2115,6 +2115,16 @@ class AttributesController extends AppController
|
|||
if ($returnFormat === 'download') {
|
||||
$returnFormat = 'json';
|
||||
}
|
||||
App::uses($validFormats[$returnFormat][1], 'Export');
|
||||
$exportTool = new $validFormats[$returnFormat][1]();
|
||||
if (empty($exportTool->non_restrictive_export)) {
|
||||
if (!isset($filters['to_ids'])) {
|
||||
$filters['to_ids'] = 1;
|
||||
}
|
||||
if (!isset($filters['published'])) {
|
||||
$filters['published'] = 1;
|
||||
}
|
||||
}
|
||||
$conditions = $this->Attribute->buildFilterConditions($this->Auth->user(), $filters);
|
||||
$params = array(
|
||||
'conditions' => $conditions,
|
||||
|
@ -2136,8 +2146,6 @@ class AttributesController extends AppController
|
|||
// this is where the new code path for the export modules will go
|
||||
throw new MethodNotFoundException('Invalid export format.');
|
||||
}
|
||||
App::uses($validFormats[$returnFormat][1], 'Export');
|
||||
$exportTool = new $validFormats[$returnFormat][1]();
|
||||
$exportToolParams = array(
|
||||
'user' => $this->Auth->user(),
|
||||
'params' => $params,
|
||||
|
|
|
@ -3055,6 +3055,14 @@ class EventsController extends AppController
|
|||
'returnFormat' => $returnFormat,
|
||||
'scope' => 'Event'
|
||||
);
|
||||
if (empty($exportTool->non_restrictive_export)) {
|
||||
if (!isset($filters['to_ids'])) {
|
||||
$filters['to_ids'] = 1;
|
||||
}
|
||||
if (!isset($filters['published'])) {
|
||||
$filters['published'] = 1;
|
||||
}
|
||||
}
|
||||
$final = $exportTool->header($exportToolParams);
|
||||
$eventCount = count($eventid);
|
||||
$i = 0;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
class JsonExport
|
||||
{
|
||||
private $__converter = false;
|
||||
public $non_restrictive_export = true;
|
||||
|
||||
public function handler($data, $options = array())
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
class XmlExport
|
||||
{
|
||||
private $__converter = false;
|
||||
public $non_restrictive_export = true;
|
||||
|
||||
public function handler($data, $options = array())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue