summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/provisioning_api/lib/Controller/AUserData.php2
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php4
-rw-r--r--lib/private/User/User.php5
-rw-r--r--lib/public/IUser.php2
-rw-r--r--tests/lib/User/UserTest.php2
5 files changed, 7 insertions, 8 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 3d6ab8f3ebf..148879d6d91 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/lib/private/User/User.php b/lib/private/User/User.php
index 56c489181de..e171a65f8ce 100644
--- a/lib/private/User/User.php
+++ b/lib/private/User/User.php
@@ -349,13 +349,12 @@ class User implements IUser {
*
* @param bool $enabled
*/
- public function setEnabled($enabled) {
+ public function setEnabled(bool $enabled = true) {
$oldStatus = $this->isEnabled();
$this->enabled = $enabled;
- $enabled = $enabled ? 'true' : 'false';
if ($oldStatus !== $this->enabled) {
$this->triggerChange('enabled', $enabled);
- $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled);
+ $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false');
}
}
diff --git a/lib/public/IUser.php b/lib/public/IUser.php
index 13aa60b3807..3d8515a5e03 100644
--- a/lib/public/IUser.php
+++ b/lib/public/IUser.php
@@ -146,7 +146,7 @@ interface IUser {
* @param bool $enabled
* @since 8.0.0
*/
- public function setEnabled($enabled);
+ public function setEnabled(bool $enabled = true);
/**
* get the users email address
diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php
index acb171d92e3..2a99e725ec7 100644
--- a/tests/lib/User/UserTest.php
+++ b/tests/lib/User/UserTest.php
@@ -816,7 +816,7 @@ class UserTest extends TestCase {
->method('triggerChange')
->with(
'enabled',
- 'false'
+ false
);
$user->setEnabled(false);