mirror of https://github.com/MISP/MISP
chg: [eventReports:extractAllFromReport] Expose functionality to API
parent
6e9d748f08
commit
309242f358
|
@ -213,10 +213,13 @@ class EventReportsController extends AppController
|
|||
|
||||
public function extractAllFromReport($reportId)
|
||||
{
|
||||
if (!$this->request->is('ajax')) {
|
||||
if (!$this->request->is('ajax') && !$this->_isRest()) {
|
||||
throw new MethodNotAllowedException(__('This function can only be reached via AJAX.'));
|
||||
}
|
||||
if ($this->request->is('post')) {
|
||||
if (!isset($this->data['EventReport'])) {
|
||||
$this->data = ['EventReport' => $this->data];
|
||||
}
|
||||
$report = $this->EventReport->fetchIfAuthorized($this->Auth->user(), $reportId, 'edit', $throwErrors=true, $full=false);
|
||||
$results = $this->EventReport->getComplexTypeToolResultWithReplacements($this->Auth->user(), $report);
|
||||
$report['EventReport']['content'] = $results['replacementResult']['contentWithReplacements'];
|
||||
|
|
Loading…
Reference in New Issue