more bugfixes
This commit is contained in:
parent
9788289260
commit
20e464776c
@ -879,14 +879,14 @@ namespace Core\API\User {
|
||||
return $this->createError("Cannot remove Administrator group from own user.");
|
||||
} else if (in_array(Group::ADMIN, $groupIds) && !$currentUser->hasGroup(Group::ADMIN)) {
|
||||
return $this->createError("You cannot add the administrator group to other users.");
|
||||
}
|
||||
|
||||
} else if (!empty($groups)) {
|
||||
$availableGroups = Group::findAll($sql, new CondIn(new Column("id"), $groupIds));
|
||||
foreach ($groupIds as $groupId) {
|
||||
if (!isset($availableGroups[$groupId])) {
|
||||
return $this->createError("Group with id=$groupId does not exist.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$user->groups = $groupIds;
|
||||
$columnsToUpdate[] = "groups";
|
||||
@ -918,8 +918,12 @@ namespace Core\API\User {
|
||||
}
|
||||
|
||||
if (!is_null($password)) {
|
||||
if ($user->isLocalAccount()) {
|
||||
$user->password = $this->hashPassword($password);
|
||||
$columnsToUpdate[] = "password";
|
||||
} else {
|
||||
return $this->createError("Cannot change password of an externally managed user account.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($confirmed)) {
|
||||
|
Loading…
Reference in New Issue
Block a user