]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: removed default limit of 25. if null is given all users are fetched or if limit...
authoryemkareems <yemkareems@gmail.com>
Thu, 4 Jul 2024 08:12:37 +0000 (13:42 +0530)
committeryemkareems <yemkareems@gmail.com>
Mon, 8 Jul 2024 10:12:55 +0000 (15:42 +0530)
Signed-off-by: yemkareems <yemkareems@gmail.com>
apps/provisioning_api/lib/Controller/UsersController.php
lib/private/AllConfig.php
lib/private/User/Manager.php
lib/public/IConfig.php

index beb240681d0ae78eb11848f2d11f29334e29aae9..66cce405335604c0f32426e9a1d82933f6dbc1d1 100644 (file)
@@ -278,7 +278,7 @@ class UsersController extends AUserData {
         * 200: Users details returned based on last logged in information
         */
        public function getLastLoggedInUsers(string $search = '',
-               ?int   $limit = 25,
+               ?int   $limit = null,
                int    $offset = 0,
        ): DataResponse {
                $currentUser = $this->userSession->getUser();
index 87b9c795f49a4751217ad89639e1f4c28ad40786..78546531dc697ffca8d0d974d1014ca7554a3ab8 100644 (file)
@@ -494,12 +494,13 @@ class AllConfig implements IConfig {
        /**
         * Gets the list of users based on their lastLogin info asc or desc
         *
-        * @param int $limit how many users to fetch
+        * @param int|null $limit how many users to fetch
         * @param int $offset from which offset to fetch
         * @param string $search search users based on search params
         * @return array of user IDs
         */
-       public function getLastLoggedInUsers(int $limit = 25, int $offset = 0, string $search = ''): array {
+       public function getLastLoggedInUsers(?int $limit = null, int $offset = 0, string $search = ''): array {
+               $limit = $this->fixLimit($limit);
                // TODO - FIXME
                $this->fixDIInit();
 
@@ -573,4 +574,12 @@ class AllConfig implements IConfig {
        public function getSystemConfig() {
                return $this->systemConfig;
        }
+
+       private function fixLimit($limit) {
+               if (is_int($limit) && $limit >= 0) {
+                       return $limit;
+               }
+
+               return null;
+       }
 }
index 93ba7f0eb6e8fa9139616f83aec3c9093544bc91..aeadb338ea009ae7cb4c195cf43920b4cbbba1e5 100644 (file)
@@ -345,7 +345,7 @@ class Manager extends PublicEmitter implements IUserManager {
        /**
         * @return IUser[]
         */
-       public function getUsersSortedByLastLogin(?int $limit = 25, int $offset = 0, $search = ''): array {
+       public function getUsersSortedByLastLogin(?int $limit = null, int $offset = 0, $search = ''): array {
                $users = $this->config->getLastLoggedInUsers($limit, $offset, $search);
                return array_combine(
                        $users,
index b74292855a82b9436a1dd923af6a146f8d1d8153..92dcfe7f8bc06ed2bf96db9f5889f88373dc3785 100644 (file)
@@ -253,11 +253,11 @@ interface IConfig {
        /**
         * Gets the list of users based on their lastLogin info asc or desc
         *
-        * @param int $limit how many records to fetch
+        * @param int|null $limit how many records to fetch
         * @param int $offset from which offset to fetch
         * @param string $search search users based on search params
         * @return array of user IDs
         * @since 30.0.0
         */
-       public function getLastLoggedInUsers(int $limit, int $offset, string $search): array;
+       public function getLastLoggedInUsers(?int $limit = null, int $offset = 0, string $search = ''): array;
 }