Skip to content

Commit 4d23d55

Browse files
committed
use LazyUser in DefaultShareProvider
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 634ee18 commit 4d23d55

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

lib/private/Share20/DefaultShareProvider.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use OC\Share20\Exception\BackendError;
3939
use OC\Share20\Exception\InvalidShare;
4040
use OC\Share20\Exception\ProviderException;
41+
use OC\User\LazyUser;
4142
use OCP\DB\QueryBuilder\IQueryBuilder;
4243
use OCP\Defaults;
4344
use OCP\Files\Folder;
@@ -946,8 +947,8 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset) {
946947
}
947948
$cursor->closeCursor();
948949
} elseif ($shareType === IShare::TYPE_GROUP) {
949-
$user = $this->userManager->get($userId);
950-
$allGroups = ($user instanceof IUser) ? $this->groupManager->getUserGroupIds($user) : [];
950+
$user = new LazyUser($userId, $this->userManager);
951+
$allGroups = $this->groupManager->getUserGroupIds($user);
951952

952953
/** @var Share[] $shares2 */
953954
$shares2 = [];
@@ -1081,9 +1082,9 @@ private function createShare($data) {
10811082

10821083
if ($share->getShareType() === IShare::TYPE_USER) {
10831084
$share->setSharedWith($data['share_with']);
1084-
$user = $this->userManager->get($data['share_with']);
1085-
if ($user !== null) {
1086-
$share->setSharedWithDisplayName($user->getDisplayName());
1085+
$displayName = $this->userManager->getDisplayName($data['share_with']);
1086+
if ($displayName !== null) {
1087+
$share->setSharedWithDisplayName($displayName);
10871088
}
10881089
} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
10891090
$share->setSharedWith($data['share_with']);

0 commit comments

Comments
 (0)