mirror of https://github.com/MISP/MISP
fix: [decaying:tool] Set `isEditable` parameter after editing a model
parent
60d407a4cc
commit
82972c4850
|
@ -235,6 +235,7 @@ class DecayingModelController extends AppController
|
||||||
if ($save_result) {
|
if ($save_result) {
|
||||||
if ($this->request->is('ajax')) {
|
if ($this->request->is('ajax')) {
|
||||||
$saved = $this->DecayingModel->fetchModel($this->Auth->user(), $this->DecayingModel->id);
|
$saved = $this->DecayingModel->fetchModel($this->Auth->user(), $this->DecayingModel->id);
|
||||||
|
$this->DecayingModel->attachIsEditableByCurrentUser($this->Auth->user(), $saved);
|
||||||
$response = array('data' => $saved, 'action' => 'edit');
|
$response = array('data' => $saved, 'action' => 'edit');
|
||||||
return $this->RestResponse->viewData($response, $this->response->type());
|
return $this->RestResponse->viewData($response, $this->response->type());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -171,6 +171,11 @@ class DecayingModel extends AppModel
|
||||||
return !$this->isDefaultModel($decaying_model) && $decaying_model['DecayingModel']['org_id'] == $user['org_id'];
|
return !$this->isDefaultModel($decaying_model) && $decaying_model['DecayingModel']['org_id'] == $user['org_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function attachIsEditableByCurrentUser($user, &$decaying_model)
|
||||||
|
{
|
||||||
|
$decaying_model['DecayingModel']['isEditable'] = $this->isEditableByCurrentUser($user, $decaying_model);
|
||||||
|
}
|
||||||
|
|
||||||
public function fetchAllAllowedModels($user, $full=true, $filters=array())
|
public function fetchAllAllowedModels($user, $full=true, $filters=array())
|
||||||
{
|
{
|
||||||
$conditions = array();
|
$conditions = array();
|
||||||
|
|
Loading…
Reference in New Issue