mirror of https://github.com/MISP/MISP
Merge branch '2.4' of github.com:MISP/MISP into chrisr3d_restSearch_tests
commit
d929099966
2
PyMISP
2
PyMISP
|
@ -1 +1 @@
|
|||
Subproject commit 532157f3c9643f5938efb55ad7317d0756282bca
|
||||
Subproject commit 442ba0717556ba955bef316d878df3b0a57c426e
|
|
@ -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')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6105522453dec9a86adce2c1ba08530aca9b9f09
|
||||
Subproject commit 6d58e288b657a941ef314aac2fef8ae6725254dd
|
|
@ -1 +1 @@
|
|||
Subproject commit 4d6e0d7580b6239e33ed268031b7a1297a6ad686
|
||||
Subproject commit 9189e8e8a47b49dff074e4df50ae6a31283d0eb0
|
|
@ -1 +1 @@
|
|||
Subproject commit 7f36c65c549c456e902413d266c93917a4d6b8d9
|
||||
Subproject commit f67d13ae654e19065e98a9810098aed1c48bffe1
|
Loading…
Reference in New Issue