diff options
author | Robin Appelman <robin@icewind.nl> | 2022-08-17 14:29:32 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-06-17 17:42:45 +0200 |
commit | 7f6a891110e7107c9056d8f5444bae62c57d89b7 (patch) | |
tree | 7d2d2607159890878a5dd2d662c477b7a161807a /lib | |
parent | 9872467251fac802b634c0276f49766be5932bdc (diff) | |
download | nextcloud-server-7f6a891110e7107c9056d8f5444bae62c57d89b7.tar.gz nextcloud-server-7f6a891110e7107c9056d8f5444bae62c57d89b7.zip |
use LazyUser in DefaultShareProvider
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 03202f215b2..634d3af4402 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -11,6 +11,7 @@ use OC\Files\Cache\Cache; use OC\Share20\Exception\BackendError; use OC\Share20\Exception\InvalidShare; use OC\Share20\Exception\ProviderException; +use OC\User\LazyUser; use OCP\AppFramework\Utility\ITimeFactory; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Defaults; @@ -909,8 +910,8 @@ class DefaultShareProvider implements IShareProvider { } $cursor->closeCursor(); } elseif ($shareType === IShare::TYPE_GROUP) { - $user = $this->userManager->get($userId); - $allGroups = ($user instanceof IUser) ? $this->groupManager->getUserGroupIds($user) : []; + $user = new LazyUser($userId, $this->userManager); + $allGroups = $this->groupManager->getUserGroupIds($user); /** @var Share[] $shares2 */ $shares2 = []; @@ -1045,9 +1046,9 @@ class DefaultShareProvider implements IShareProvider { if ($share->getShareType() === IShare::TYPE_USER) { $share->setSharedWith($data['share_with']); - $user = $this->userManager->get($data['share_with']); - if ($user !== null) { - $share->setSharedWithDisplayName($user->getDisplayName()); + $displayName = $this->userManager->getDisplayName($data['share_with']); + if ($displayName !== null) { + $share->setSharedWithDisplayName($displayName); } } elseif ($share->getShareType() === IShare::TYPE_GROUP) { $share->setSharedWith($data['share_with']); |