Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Check if password can be changed for the users backend in OCS api
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr authored and Backportbot committed Mar 5, 2019
commit 05f3abaf6b119e7add083fc649b16c0f539579d6
3 changes: 3 additions & 0 deletions apps/provisioning_api/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ public function editUser(string $userId, string $key, string $value): DataRespon
break;
case 'password':
try {
if (!$targetUser->canChangePassword()) {
throw new OCSException('Setting the password is not supported by the users backend', 103);
}
$targetUser->setPassword($value);
} catch (HintException $e) { // password policy error
throw new OCSException($e->getMessage(), 103);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,10 @@ public function testEditUserRegularUserSelfEditChangePassword() {
->method('get')
->with('UserToEdit')
->will($this->returnValue($targetUser));
$targetUser
->expects($this->once())
->method('canChangePassword')
->will($this->returnValue(true));
$targetUser
->expects($this->once())
->method('setPassword')
Expand Down