fix: [decaying:tool] Set `isEditable` parameter after editing a model

pull/5032/head
mokaddem 2019-08-23 09:01:04 +02:00
parent 60d407a4cc
commit 82972c4850
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 6 additions and 0 deletions

View File

@ -235,6 +235,7 @@ class DecayingModelController extends AppController
if ($save_result) {
if ($this->request->is('ajax')) {
$saved = $this->DecayingModel->fetchModel($this->Auth->user(), $this->DecayingModel->id);
$this->DecayingModel->attachIsEditableByCurrentUser($this->Auth->user(), $saved);
$response = array('data' => $saved, 'action' => 'edit');
return $this->RestResponse->viewData($response, $this->response->type());
} else {

View File

@ -171,6 +171,11 @@ class DecayingModel extends AppModel
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())
{
$conditions = array();