chg: [restResponse] Return role_id along with its name

pull/7038/head
mokaddem 2021-02-19 08:59:54 +01:00
parent 309db2a37a
commit 0e2e5bdbe1
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 6 additions and 3 deletions

View File

@ -1890,10 +1890,13 @@ class RestResponseComponent extends Component
}
private function __overwriteRoleId($scope, $action, &$field) {
$this->{$scope} = ClassRegistry::init("Role");
$roles = $this->{$scope}->find('column', array(
'fields' => array('name')
$roles = $this->{$scope}->find('list', array(
'fields' => array('id', 'name')
));
$field['values'] = $roles;
$field['values'] = [];
foreach ($roles as $id => $name) {
$field['values'][] = ['label' => $name, 'value' => $id];
}
}
private function __overwriteSeen($scope, $action, &$field) {
if ($action == 'restSearch') {