summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-04-16 18:09:11 +0200
committerGitHub <noreply@github.com>2018-04-16 18:09:11 +0200
commitd93948426cc1ed1917706ab1e918a338829986eb (patch)
treed7ce17805181e4c99d7df63d0a4477b2f6b50034
parent056660bf7ce0e587be7276e640e424280ff66804 (diff)
parent3e5ea9b0a92c8c1210b2349491d7460835cba738 (diff)
downloadnextcloud-server-d93948426cc1ed1917706ab1e918a338829986eb.tar.gz
nextcloud-server-d93948426cc1ed1917706ab1e918a338829986eb.zip
Merge pull request #9168 from nextcloud/enabled-state-proper-return-and-tests-fixes
Return proper boolean user enabled state api
-rw-r--r--apps/provisioning_api/lib/Controller/AUserData.php2
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php4
-rw-r--r--build/integration/features/bootstrap/Provisioning.php6
3 files changed, 7 insertions, 5 deletions
diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php
index 82ca98ced8c..6c4967a6c3b 100644
--- a/apps/provisioning_api/lib/Controller/AUserData.php
+++ b/apps/provisioning_api/lib/Controller/AUserData.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()) {
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 6959f16f5cb..7625218e7e5 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -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',
diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php
index 2543777faa5..0bc99cc561d 100644
--- a/build/integration/features/bootstrap/Provisioning.php
+++ b/build/integration/features/bootstrap/Provisioning.php
@@ -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);
}
/**