chg: [userSettings:add] Adhere to the passed user context
parent
dc8710d89e
commit
7de1c14407
|
@ -57,7 +57,7 @@ class UserSettingsController extends AppController
|
|||
}
|
||||
}
|
||||
|
||||
public function add($user_id = false)
|
||||
public function add($user_id=null)
|
||||
{
|
||||
$currentUser = $this->ACL->getUser();
|
||||
$this->CRUD->add([
|
||||
|
@ -77,6 +77,8 @@ class UserSettingsController extends AppController
|
|||
if (empty($currentUser['role']['perm_admin'])) {
|
||||
$allUsers->where(['id' => $currentUser->id]);
|
||||
$user_id = $currentUser->id;
|
||||
} else if (!is_null($user_id)) {
|
||||
$allUsers->where(['id' => $user_id]);
|
||||
}
|
||||
$dropdownData = [
|
||||
'user' => $allUsers->all()->toArray(),
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
'type' => 'dropdown',
|
||||
'label' => __('User'),
|
||||
'options' => $dropdownData['user'],
|
||||
'value' => !empty($user_id) ? $user_id : '',
|
||||
'disabled' => !empty($user_id),
|
||||
'value' => !is_null($user_id) ? $user_id : '',
|
||||
],
|
||||
[
|
||||
'field' => 'name',
|
||||
|
|
Loading…
Reference in New Issue