Browse Source
Return proper boolean user enabled state api
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
pull/9168/head
John Molakvoæ (skjnldsv)
8 years ago
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
3 changed files with
7 additions and
5 deletions
-
apps/provisioning_api/lib/Controller/AUserData.php
-
apps/provisioning_api/tests/Controller/UsersControllerTest.php
-
build/integration/features/bootstrap/Provisioning.php
|
|
|
@ -92,7 +92,7 @@ abstract class AUserData extends OCSController { |
|
|
|
// Should be at least Admin Or SubAdmin!
|
|
|
|
if( $this->groupManager->isAdmin($currentLoggedInUser->getUID()) |
|
|
|
|| $this->groupManager->getSubAdmin()->isUserAccessible($currentLoggedInUser, $targetUserObject)) { |
|
|
|
$data['enabled'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'enabled', 'true'); |
|
|
|
$data['enabled'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'enabled', 'true') === 'true'; |
|
|
|
} else { |
|
|
|
// Check they are looking up themselves
|
|
|
|
if($currentLoggedInUser->getUID() !== $targetUserObject->getUID()) { |
|
|
|
|
|
|
|
@ -766,7 +766,7 @@ class UsersControllerTest extends TestCase { |
|
|
|
|
|
|
|
$expected = [ |
|
|
|
'id' => 'UID', |
|
|
|
'enabled' => 'true', |
|
|
|
'enabled' => true, |
|
|
|
'storageLocation' => '/var/www/newtcloud/data/UID', |
|
|
|
'lastLogin' => 1521191471000, |
|
|
|
'backend' => 'Database', |
|
|
|
@ -881,7 +881,7 @@ class UsersControllerTest extends TestCase { |
|
|
|
|
|
|
|
$expected = [ |
|
|
|
'id' => 'UID', |
|
|
|
'enabled' => 'true', |
|
|
|
'enabled' => true, |
|
|
|
'storageLocation' => '/var/www/newtcloud/data/UID', |
|
|
|
'lastLogin' => 1521191471000, |
|
|
|
'backend' => 'Database', |
|
|
|
|
|
|
|
@ -694,7 +694,8 @@ trait Provisioning { |
|
|
|
]; |
|
|
|
|
|
|
|
$this->response = $client->get($fullUrl, $options); |
|
|
|
PHPUnit_Framework_Assert::assertEquals("false", simplexml_load_string($this->response->getBody())->data[0]->enabled); |
|
|
|
// false in xml is empty
|
|
|
|
PHPUnit_Framework_Assert::assertTrue(empty(simplexml_load_string($this->response->getBody())->data[0]->enabled)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -713,7 +714,8 @@ trait Provisioning { |
|
|
|
]; |
|
|
|
|
|
|
|
$this->response = $client->get($fullUrl, $options); |
|
|
|
PHPUnit_Framework_Assert::assertEquals("true", simplexml_load_string($this->response->getBody())->data[0]->enabled); |
|
|
|
// boolean to string is integer
|
|
|
|
PHPUnit_Framework_Assert::assertEquals("1", simplexml_load_string($this->response->getBody())->data[0]->enabled); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|