mirror of https://github.com/MISP/MISP
fix: [analyst-data:edit] Bump `modified` field before updating
parent
1444523dfa
commit
f71b50d3d7
|
@ -71,12 +71,16 @@ class AnalystDataController extends AppController
|
|||
$conditions = $this->AnalystData->buildConditions($this->Auth->user());
|
||||
$params = [
|
||||
'conditions' => $conditions,
|
||||
'afterFind' => function(array $analystData) {
|
||||
'afterFind' => function(array $analystData): array {
|
||||
$canEdit = $this->ACL->canEditAnalystData($this->Auth->user(), $analystData, $this->modelSelection);
|
||||
if (!$canEdit) {
|
||||
throw new MethodNotAllowedException(__('You are not authorised to do that.'));
|
||||
}
|
||||
return $analystData;
|
||||
},
|
||||
'beforeSave' => function(array $analystData): array {
|
||||
$analystData[$this->modelSelection]['modified'] = date ('Y-m-d H:i:s');
|
||||
return $analystData;
|
||||
}
|
||||
];
|
||||
$this->CRUD->edit($id, $params);
|
||||
|
|
Loading…
Reference in New Issue