Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/private/Group/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace OC\Group;

use OC\User\LazyUser;
use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Group\Backend\ABackend;
Expand Down Expand Up @@ -425,7 +424,7 @@ public function searchInGroup(string $gid, string $search = '', int $limit = -1,
$users = [];
$userManager = Server::get(IUserManager::class);
while ($row = $result->fetchAssociative()) {
$users[$row['uid']] = new LazyUser($row['uid'], $userManager, $row['displayname'] ?? null);
$users[$row['uid']] = $userManager->getLazyUser($row['uid'], $row['displayname'] ?? null);
}
$result->closeCursor();

Expand Down
4 changes: 4 additions & 0 deletions lib/private/User/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@
return false;
}

public function getLazyUser(string $uid, string $displayName = null, ?IUserBackend $backend = null): IUser {

Check failure on line 463 in lib/private/User/Manager.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

MissingOverrideAttribute

lib/private/User/Manager.php:463:2: MissingOverrideAttribute: Method OC\User\Manager::getlazyuser should have the "Override" attribute (see https://psalm.dev/358)
return new LazyUser($uid, $this, $displayName, $backend);

Check failure on line 464 in lib/private/User/Manager.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidArgument

lib/private/User/Manager.php:464:50: InvalidArgument: Argument 4 of OC\User\LazyUser::__construct expects OCP\UserInterface|null, but OCP\IUserBackend|null provided (see https://psalm.dev/004)
}

/**
* returns how many users per backend exist (if supported by backend)
*
Expand Down
13 changes: 13 additions & 0 deletions lib/public/IUserManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace OCP;

use OC\User\LazyUser;
use OCP\AppFramework\Attribute\Implementable;

/**
* Class Manager
*
Expand All @@ -24,6 +27,7 @@
*
* @since 8.0.0
*/
#[Implementable(since: '8.0.0')]
interface IUserManager {
/**
* @since 26.0.0
Expand Down Expand Up @@ -161,6 +165,15 @@ public function createUser($uid, $password);
*/
public function createUserFromBackend($uid, $password, UserInterface $backend);

/**
* Create a lazy user.
*
* This will create a lazy user object which will be then loaded when needed.
*
* @since 35.0.0
*/
public function getLazyUser(string $uid, string $displayName = null, ?IUserBackend $backend = null): IUser;

/**
* Get how many users per backend exist (if supported by backend)
*
Expand Down
Loading