diff --git a/PyMISP b/PyMISP index 532157f3c..442ba0717 160000 --- a/PyMISP +++ b/PyMISP @@ -1 +1 @@ -Subproject commit 532157f3c9643f5938efb55ad7317d0756282bca +Subproject commit 442ba0717556ba955bef316d878df3b0a57c426e diff --git a/app/Controller/Component/RestResponseComponent.php b/app/Controller/Component/RestResponseComponent.php index 6a260f769..948d157ad 100644 --- a/app/Controller/Component/RestResponseComponent.php +++ b/app/Controller/Component/RestResponseComponent.php @@ -210,9 +210,8 @@ class RestResponseComponent extends Component ), 'Warninglist' => array( 'toggleEnable' => array( - 'description' => "POST a json object with a single or a list of warninglist IDs to toggle whether they're enabled or disabled. Specify the optional enabled boolean flag if you would like to enforce the outcome state. Not setting this flag will just toggle the current state.", - 'mandatory' => array('id'), - 'optional' => array('enabled') + 'description' => "POST a json object with a single or a list of warninglist IDsIDs, or alternatively a (list of) substring(s) that match the names of warninglist(s) to toggle whether they're enabled or disabled. Specify the optional enabled boolean flag if you would like to enforce the outcome state. Not setting this flag will just toggle the current state.",'mandatory' => array('id'), + 'optional' => array('id', 'name', 'enabled') ) ) ); diff --git a/app/Controller/WarninglistsController.php b/app/Controller/WarninglistsController.php index 1c5113610..eaa654b58 100644 --- a/app/Controller/WarninglistsController.php +++ b/app/Controller/WarninglistsController.php @@ -123,6 +123,8 @@ class WarninglistsController extends AppController * To control what state the warninglists should have after execution instead of just blindly toggling them, simply pass the enabled flag * Example: * {"id": [5, 8], "enabled": 1} + * Alternatively search by a substring in the warninglist's named, such as: + * {"name": ["%alexa%", "%iana%"], "enabled": 1} */ public function toggleEnable() { @@ -132,7 +134,24 @@ class WarninglistsController extends AppController if (isset($this->request->data['Warninglist']['data'])) { $id = $this->request->data['Warninglist']['data']; } else { - $id = $this->request->data['id']; + if (!empty($this->request->data['id'])) { + $id = $this->request->data['id']; + } else if (!empty($this->request->data['name'])) { + if (!is_array($this->request->data['name'])) { + $names = array($this->request->data['name']); + } else { + $names = $this->request->data['name']; + } + $conditions = array(); + foreach ($names as $k => $name) { + $conditions['OR'][] = array('LOWER(Warninglist.name) LIKE' => strtolower($name)); + } + $id = $this->Warninglist->find('list', array( + 'conditions' => $conditions, + 'recursive' => -1, + 'fields' => array('Warninglist.id', 'Warninglist.id') + )); + } } if (isset($this->request->data['enabled'])) { $enabled = $this->request->data['enabled']; diff --git a/app/files/misp-galaxy b/app/files/misp-galaxy index 610552245..6d58e288b 160000 --- a/app/files/misp-galaxy +++ b/app/files/misp-galaxy @@ -1 +1 @@ -Subproject commit 6105522453dec9a86adce2c1ba08530aca9b9f09 +Subproject commit 6d58e288b657a941ef314aac2fef8ae6725254dd diff --git a/app/files/misp-objects b/app/files/misp-objects index 4d6e0d758..9189e8e8a 160000 --- a/app/files/misp-objects +++ b/app/files/misp-objects @@ -1 +1 @@ -Subproject commit 4d6e0d7580b6239e33ed268031b7a1297a6ad686 +Subproject commit 9189e8e8a47b49dff074e4df50ae6a31283d0eb0 diff --git a/app/files/taxonomies b/app/files/taxonomies index 7f36c65c5..f67d13ae6 160000 --- a/app/files/taxonomies +++ b/app/files/taxonomies @@ -1 +1 @@ -Subproject commit 7f36c65c549c456e902413d266c93917a4d6b8d9 +Subproject commit f67d13ae654e19065e98a9810098aed1c48bffe1