mirror of https://github.com/MISP/MISP
fix: [CRUD] accept contain as a parameter for edit, fixes an issue with auth key edits
parent
a61caa3a6a
commit
e729ad9225
|
@ -83,6 +83,7 @@ class AuthKeysController extends AppController
|
|||
return $authKey;
|
||||
},
|
||||
'fields' => ['comment', 'allowed_ips', 'expiration'],
|
||||
'contain' => ['User.id', 'User.org_id']
|
||||
]);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
|
|
|
@ -155,12 +155,15 @@ class CRUDComponent extends Component
|
|||
$query = isset($params['get']) ? $params['get'] : [
|
||||
'recursive' => -1,
|
||||
'conditions' => [
|
||||
'id' => $id
|
||||
$modelName . '.id' => $id
|
||||
],
|
||||
];
|
||||
if (!empty($params['conditions'])) {
|
||||
$query['conditions']['AND'][] = $params['conditions'];
|
||||
}
|
||||
if (!empty($params['contain'])) {
|
||||
$query['contain'] = $params['contain'];
|
||||
}
|
||||
/** @var Model $model */
|
||||
$model = $this->Controller->{$modelName};
|
||||
$data = $model->find('first', $query);
|
||||
|
|
Loading…
Reference in New Issue