|
33 | 33 | use OCP\Share\IAttributes; |
34 | 34 | use OCP\Share\IManager; |
35 | 35 | use OCP\Share\IShare; |
| 36 | +use OCP\Share\IShareProviderGetUsers; |
36 | 37 | use OCP\Share\IShareProviderSupportsAccept; |
37 | 38 | use OCP\Share\IShareProviderSupportsAllSharesInFolder; |
38 | 39 | use OCP\Share\IShareProviderWithNotification; |
|
44 | 45 | * |
45 | 46 | * @package OC\Share20 |
46 | 47 | */ |
47 | | -class DefaultShareProvider implements IShareProviderWithNotification, IShareProviderSupportsAccept, IShareProviderSupportsAllSharesInFolder { |
| 48 | +class DefaultShareProvider implements |
| 49 | + IShareProviderWithNotification, |
| 50 | + IShareProviderSupportsAccept, |
| 51 | + IShareProviderSupportsAllSharesInFolder, |
| 52 | + IShareProviderGetUsers { |
48 | 53 | public function __construct( |
49 | 54 | private IDBConnection $dbConn, |
50 | 55 | private IUserManager $userManager, |
@@ -1678,4 +1683,15 @@ protected function formatShareAttributes(?IAttributes $attributes): ?string { |
1678 | 1683 | } |
1679 | 1684 | return \json_encode($compressedAttributes); |
1680 | 1685 | } |
| 1686 | + |
| 1687 | + public function getUsersForShare(IShare $share): iterable { |
| 1688 | + if ($share->getShareType() === IShare::TYPE_USER) { |
| 1689 | + return [new LazyUser($share->getSharedWith(), $this->userManager)]; |
| 1690 | + } elseif ($share->getShareType() === IShare::TYPE_GROUP) { |
| 1691 | + $group = $this->groupManager->get($share->getSharedWith()); |
| 1692 | + return $group->getUsers(); |
| 1693 | + } else { |
| 1694 | + return []; |
| 1695 | + } |
| 1696 | + } |
1681 | 1697 | } |
0 commit comments