aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php14
-rw-r--r--lib/private/AllConfig.php11
-rw-r--r--lib/private/User/Manager.php15
-rw-r--r--lib/public/IUserManager.php5
4 files changed, 5 insertions, 40 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index 66cce405335..1d3c1006a59 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -266,9 +266,7 @@ class UsersController extends AUserData {
}
/**
- * @NoAdminRequired
- *
- * Get the list of last logged-in users and their details
+ * Gets the list of users sorted by lastLogin, from most recent to least recent
*
* @param string $search Text to search for
* @param ?int $limit Limit the amount of users returned
@@ -278,8 +276,8 @@ class UsersController extends AUserData {
* 200: Users details returned based on last logged in information
*/
public function getLastLoggedInUsers(string $search = '',
- ?int $limit = null,
- int $offset = 0,
+ ?int $limit = null,
+ int $offset = 0,
): DataResponse {
$currentUser = $this->userSession->getUser();
if ($currentUser === null) {
@@ -295,11 +293,7 @@ class UsersController extends AUserData {
$users = [];
// For Admin alone user sorting based on lastLogin. For sub admin and groups this is not supported
- $uid = $currentUser->getUID();
- if ($this->groupManager->isAdmin($uid)) {
- $users = $this->userManager->getUsersSortedByLastLogin($limit, $offset, $search);
- $users = array_map(fn (IUser $user): string => $user->getUID(), $users);
- }
+ $users = $this->config->getLastLoggedInUsers($limit, $offset, $search);
$usersDetails = [];
foreach ($users as $userId) {
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index 78546531dc6..f39182683f5 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -492,7 +492,7 @@ class AllConfig implements IConfig {
}
/**
- * Gets the list of users based on their lastLogin info asc or desc
+ * Gets the list of user ids sorted by lastLogin, from most recent to least recent
*
* @param int|null $limit how many users to fetch
* @param int $offset from which offset to fetch
@@ -500,7 +500,6 @@ class AllConfig implements IConfig {
* @return array of user IDs
*/
public function getLastLoggedInUsers(?int $limit = null, int $offset = 0, string $search = ''): array {
- $limit = $this->fixLimit($limit);
// TODO - FIXME
$this->fixDIInit();
@@ -574,12 +573,4 @@ class AllConfig implements IConfig {
public function getSystemConfig() {
return $this->systemConfig;
}
-
- private function fixLimit($limit) {
- if (is_int($limit) && $limit >= 0) {
- return $limit;
- }
-
- return null;
- }
}
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php
index aeadb338ea0..d93431a2699 100644
--- a/lib/private/User/Manager.php
+++ b/lib/private/User/Manager.php
@@ -343,21 +343,6 @@ class Manager extends PublicEmitter implements IUserManager {
}
/**
- * @return IUser[]
- */
- public function getUsersSortedByLastLogin(?int $limit = null, int $offset = 0, $search = ''): array {
- $users = $this->config->getLastLoggedInUsers($limit, $offset, $search);
- return array_combine(
- $users,
- array_map(
- fn (string $uid): IUser => new LazyUser($uid, $this),
- $users
- )
- );
- }
-
-
- /**
* Search known users (from phonebook sync) by displayName
*
* @param string $searcher
diff --git a/lib/public/IUserManager.php b/lib/public/IUserManager.php
index 8b080fd75c5..851b565f617 100644
--- a/lib/public/IUserManager.php
+++ b/lib/public/IUserManager.php
@@ -125,11 +125,6 @@ interface IUserManager {
public function getDisabledUsers(?int $limit = null, int $offset = 0, string $search = ''): array;
/**
- * @return IUser[]
- * @since 30.0.0
- */
- public function getUsersSortedByLastLogin(?int $limit = null, int $offset = 0, $search = ''): array;
- /**
* Search known users (from phonebook sync) by displayName
*
* @param string $searcher