Skip to content

Commit 54c280c

Browse files
committed
chore: Implement getUsersForShare on share provider
Signed-off-by: Julius Knorr <jus@bitgrid.net>
1 parent 1187643 commit 54c280c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lib/Sharing/DeckShareProvider.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use OCP\Share\Exceptions\ShareNotFound;
3434
use OCP\Share\IManager;
3535
use OCP\Share\IShare;
36+
use OCP\Share\IShareProviderGetUsers;
3637

3738
/** Taken from the talk shareapicontroller helper */
3839
interface IShareProviderBackend {
@@ -42,7 +43,7 @@ public function formatShare(IShare $share): array;
4243
public function canAccessShare(IShare $share, string $user): bool;
4344
}
4445

45-
class DeckShareProvider implements \OCP\Share\IShareProvider {
46+
class DeckShareProvider implements \OCP\Share\IShareProvider, IShareProviderGetUsers {
4647
public const DECK_FOLDER = '/Deck';
4748
public const DECK_FOLDER_PLACEHOLDER = '/{DECK_PLACEHOLDER}';
4849

@@ -1067,4 +1068,20 @@ public function getOrphanedAttachmentShares(): array {
10671068

10681069
return $shares;
10691070
}
1071+
1072+
public function getUsersForShare(IShare $share): iterable {
1073+
if ($share->getShareType() === IShare::TYPE_DECK) {
1074+
$cardId = (int)$share->getSharedWith();
1075+
$boardId = $this->cardMapper->findBoardId($cardId);
1076+
if ($boardId === null) {
1077+
return [];
1078+
}
1079+
1080+
foreach ($this->permissionService->findUsers($boardId) as $user) {
1081+
yield $user->getUserObject();
1082+
}
1083+
}
1084+
1085+
return [];
1086+
}
10701087
}

0 commit comments

Comments
 (0)