]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix since annotations and add boolean return type for setUserEnabled
authorCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 20 Jun 2023 13:10:39 +0000 (15:10 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 20 Jun 2023 13:10:39 +0000 (15:10 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/user_ldap/lib/User_LDAP.php
apps/user_ldap/lib/User_Proxy.php
lib/private/User/User.php
lib/public/User/Backend/IProvideEnabledStateBackend.php

index fcd5a009e413e86be2d380294658db3583dda4a4..d4a851bd7aa7e78912db936c8b76a9afd9e55ccb 100644 (file)
@@ -677,7 +677,8 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I
                }
        }
 
-       public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): void {
+       public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): bool {
                $setDatabaseValue($enabled);
+               return $enabled;
        }
 }
index c95329cebed60ce7b49584fecb5ee8d78f83b9f3..e0f1bb2d522afdbde98fb8e3ce72ef2730b9a561 100644 (file)
@@ -458,7 +458,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP
                return $this->handleRequest($uid, 'isUserEnabled', [$uid, $queryDatabaseValue]);
        }
 
-       public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): void {
-               $this->handleRequest($uid, 'setUserEnabled', [$uid, $enabled, $queryDatabaseValue, $setDatabaseValue]);
+       public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): bool {
+               return $this->handleRequest($uid, 'setUserEnabled', [$uid, $enabled, $queryDatabaseValue, $setDatabaseValue]);
        }
 }
index 3b7123bd5751db804513b1acac1dfa1e7b866d56..edaab879ef7be47ebb33ee150b35fa1e4e721b16 100644 (file)
@@ -438,7 +438,7 @@ class User implements IUser {
                                $enabled = $this->config->getUserValue($this->uid, 'core', 'enabled', 'true');
                                $this->enabled = $enabled === 'true';
                        }
-                       return (bool) $this->enabled;
+                       return $this->enabled;
                };
                if ($this->backend instanceof IProvideEnabledStateBackend) {
                        return $this->backend->isUserEnabled($this->uid, $queryDatabaseValue);
@@ -464,9 +464,9 @@ class User implements IUser {
                                        $enabled = $this->config->getUserValue($this->uid, 'core', 'enabled', 'true');
                                        $this->enabled = $enabled === 'true';
                                }
-                               return (bool) $this->enabled;
+                               return $this->enabled;
                        };
-                       $this->backend->setUserEnabled($this->uid, $enabled, $queryDatabaseValue, $setDatabaseValue);
+                       $enabled = $this->backend->setUserEnabled($this->uid, $enabled, $queryDatabaseValue, $setDatabaseValue);
                        if ($oldStatus !== $enabled) {
                                $this->triggerChange('enabled', $enabled, $oldStatus);
                        }
index 143eca548ab921bba08b49715705eba6eaf4a809..8a4755ffbef0bc987150c737408c866d111c4e34 100644 (file)
@@ -27,21 +27,21 @@ declare(strict_types=1);
 namespace OCP\User\Backend;
 
 /**
- * @since 26.0.0
+ * @since 28.0.0
  */
 interface IProvideEnabledStateBackend {
        /**
-        * @since 26.0.0
+        * @since 28.0.0
         *
         * @param callable():bool $queryDatabaseValue A callable to query the enabled state from database
         */
        public function isUserEnabled(string $uid, callable $queryDatabaseValue): bool;
 
        /**
-        * @since 26.0.0
+        * @since 28.0.0
         *
         * @param callable():bool $queryDatabaseValue A callable to query the enabled state from database
         * @param callable(bool):void $setDatabaseValue A callable to set the enabled state in the database.
         */
-       public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): void;
+       public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): bool;
 }