Browse Source
Check if password can be changed for the users backend in OCS api
Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/14451/head
Julius Härtl
8 years ago
committed by
Roeland Jago Douma
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with
7 additions and
0 deletions
-
apps/provisioning_api/lib/Controller/UsersController.php
-
apps/provisioning_api/tests/Controller/UsersControllerTest.php
|
|
|
@ -513,6 +513,9 @@ class UsersController extends AUserData { |
|
|
|
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); |
|
|
|
|
|
|
|
@ -1270,6 +1270,10 @@ class UsersControllerTest extends TestCase { |
|
|
|
->method('get') |
|
|
|
->with('UserToEdit') |
|
|
|
->will($this->returnValue($targetUser)); |
|
|
|
$targetUser |
|
|
|
->expects($this->once()) |
|
|
|
->method('canChangePassword') |
|
|
|
->will($this->returnValue(true)); |
|
|
|
$targetUser |
|
|
|
->expects($this->once()) |
|
|
|
->method('setPassword') |
|
|
|
|