mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
fix setting role of user when creating a new user
This commit is contained in:
parent
06f0e1423b
commit
cf786e749a
|
@ -2053,10 +2053,10 @@ class RestapiController { /* {{{ */
|
|||
$language = isset($params['language']) ? $params['language'] : null;;
|
||||
$theme = isset($params['theme']) ? $params['theme'] : null;
|
||||
$comment = isset($params['comment']) ? $params['comment'] : null;
|
||||
$role = isset($params['role']) ? $params['role'] : null;
|
||||
$roleid = $role == 'admin' ? SeedDMS_Core_User::role_admin : ($role == 'guest' ? SeedDMS_Core_User::role_guest : SeedDMS_Core_User::role_user);
|
||||
$role = isset($params['role']) ? $params['role'] : 3;
|
||||
$roleobj = $role == 'admin' ? SeedDMS_Core_Role::getInstance(1, $dms) : ($role == 'guest' ? SeedDMS_Core_Role::getInstance(2, $dms) : SeedDMS_Core_Role::getInstance($role, $dms));
|
||||
|
||||
$newAccount = $dms->addUser($userName, $password, $fullname, $email, $language, $theme, $comment, $roleid);
|
||||
$newAccount = $dms->addUser($userName, $password, $fullname, $email, $language, $theme, $comment, $roleobj);
|
||||
if ($newAccount === false) {
|
||||
return $response->withJson(array('success'=>false, 'message'=>'Account could not be created, maybe it already exists', 'data'=>''), 500);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user