chg: [internal] fetch first role if no default is set

pull/163/head
iglocska 2023-06-28 14:59:31 +02:00
parent a11f935969
commit 82bf3a74c1
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 3 additions and 0 deletions

View File

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