mirror of https://github.com/MISP/MISP
fix: [workflow] Importing blueprints
parent
1edaa324b4
commit
6da7ba5b7a
|
@ -101,11 +101,8 @@ class WorkflowBlueprintsController extends AppController
|
|||
public function import()
|
||||
{
|
||||
if ($this->request->is('post') || $this->request->is('put')) {
|
||||
$workflowBlueprintData = JsonTool::decode($this->request->data['WorkflowBlueprint']['json']);
|
||||
if ($workflowBlueprintData === null) {
|
||||
throw new MethodNotAllowedException(__('Error while decoding JSON'));
|
||||
}
|
||||
$this->request->data['WorkflowBlueprint']['data'] = JsonTool::encode($workflowBlueprintData);
|
||||
$workflowBlueprintData = $this->_jsonDecode($this->request->data['WorkflowBlueprint']['json']);
|
||||
$this->request->data = $workflowBlueprintData;
|
||||
$this->add();
|
||||
}
|
||||
}
|
||||
|
@ -117,6 +114,10 @@ class WorkflowBlueprintsController extends AppController
|
|||
'id' => $id,
|
||||
]
|
||||
]);
|
||||
if (empty($workflowBlueprint)) {
|
||||
throw new NotFoundException(__('Invalid workflow blueprint'));
|
||||
}
|
||||
|
||||
$content = JsonTool::encode($workflowBlueprint, true);
|
||||
$this->response->body($content);
|
||||
$this->response->type('json');
|
||||
|
|
|
@ -19,6 +19,7 @@ class WorkflowBlueprint extends AppModel
|
|||
|
||||
|
||||
public $validate = [
|
||||
'name' => 'stringNotEmpty',
|
||||
'value' => [
|
||||
'stringNotEmpty' => [
|
||||
'rule' => ['stringNotEmpty']
|
||||
|
@ -111,6 +112,7 @@ class WorkflowBlueprint extends AppModel
|
|||
*
|
||||
* @param boolean $force
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($force=false)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue