fix: [internal] user add fix attempt #2

pull/163/head
iglocska 2023-06-28 15:01:26 +02:00
parent 82bf3a74c1
commit d7bf8af5b1
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 3 additions and 2 deletions

View File

@ -74,10 +74,11 @@ class UsersController extends AppController
} else {
$validRoles = $this->Users->Roles->find('list')->order(['name' => 'asc'])->all()->toArray();
}
$defaultRole = $this->Users->Roles->find()->select(['id'])->where(['is_default' => true])->first()->toArray();
$defaultRole = $this->Users->Roles->find()->select(['id'])->where(['is_default' => true])->first();
if (empty($defaultRole)) {
$defaultRole = $this->Users->Roles->find()->select(['id'])->first()->toArray();
$defaultRole = $this->Users->Roles->find()->select(['id'])->first();
}
$defaultRole = $defaultRole->toArray();
$individuals = $this->Users->Individuals->find('list', $individuals_params)->toArray();
$this->CRUD->add([
'beforeMarshal' => function($data) {