Properly return boolean on enable state

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
pull/9111/head
John Molakvoæ (skjnldsv) 7 years ago
parent e970e9f710
commit eae55761de
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
  1. 2
      apps/provisioning_api/lib/Controller/AUserData.php
  2. 5
      lib/private/User/User.php
  3. 2
      lib/public/IUser.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()) {

@ -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');
}
}

@ -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

Loading…
Cancel
Save