Skip to content

Commit

Permalink
use LazyUser in DefaultShareProvider
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Aug 17, 2022
1 parent 634ee18 commit 4d23d55
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/private/Share20/DefaultShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use OC\Share20\Exception\BackendError;
use OC\Share20\Exception\InvalidShare;
use OC\Share20\Exception\ProviderException;
use OC\User\LazyUser;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Defaults;
use OCP\Files\Folder;
Expand Down Expand Up @@ -946,8 +947,8 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset) {
}
$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 = [];
Expand Down Expand Up @@ -1081,9 +1082,9 @@ private function createShare($data) {

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']);
Expand Down

0 comments on commit 4d23d55

Please sign in to comment.