fix: [API] Feed index shouldn't adhere to pagination defaults of the UI, fixes MISP/misp-book#149

pull/4408/head
iglocska 2019-04-01 14:20:09 +02:00
parent a7761e2b7d
commit a10e175f83
1 changed files with 14 additions and 2 deletions

View File

@ -50,7 +50,19 @@ class FeedsController extends AppController
);
}
}
$data = $this->paginate();
if ($this->_isRest()) {
$keepFields = array('conditions', 'contain', 'recursive', 'sort');
$searchParams = array();
foreach ($keepFields as $field) {
if (!empty($this->paginate[$field])) {
$searchParams[$field] = $this->paginate[$field];
}
}
$data = $this->Feed->find('all', $searchParams);
} else {
$data = $this->paginate();
}
$this->loadModel('Event');
foreach ($data as $key => $value) {
if ($value['Feed']['event_id'] != 0 && $value['Feed']['fixed_event']) {
@ -101,7 +113,7 @@ class FeedsController extends AppController
$this->set('other_feeds', $feeds);
$this->set('feed', $feed);
}
public function feedCoverage($feedId)
{
if (!$this->_isSiteAdmin() && !$this->Auth->user('org_id') == Configure::read('MISP.host_org_id')) {