diff --git a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php index 1d625b35322a1..c4fc0c068cfda 100644 --- a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php +++ b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php @@ -11,6 +11,7 @@ * @author John Molakvoæ * @author Julius Härtl * @author Roeland Jago Douma + * @author Kate Döen * * @license GNU AGPL version 3 or any later version * @@ -28,14 +29,18 @@ * along with this program. If not, see . * */ + namespace OCA\Files_Sharing\Controller; +use OCA\Deck\Sharing\ShareAPIHelper; +use OCA\Files_Sharing\ResponseDefinitions; use OCP\App\IAppManager; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCSController; use OCP\AppFramework\QueryException; +use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\IGroupManager; @@ -71,14 +76,14 @@ class DeletedShareAPIController extends OCSController { private $serverContainer; public function __construct(string $appName, - IRequest $request, - ShareManager $shareManager, - string $UserId, - IUserManager $userManager, - IGroupManager $groupManager, - IRootFolder $rootFolder, - IAppManager $appManager, - IServerContainer $serverContainer) { + IRequest $request, + ShareManager $shareManager, + string $UserId, + IUserManager $userManager, + IGroupManager $groupManager, + IRootFolder $rootFolder, + IAppManager $appManager, + IServerContainer $serverContainer) { parent::__construct($appName, $request); $this->shareManager = $shareManager; @@ -121,7 +126,7 @@ private function formatShare(IShare $share): array { } $result['path'] = $userFolder->getRelativePath($node->getPath()); - if ($node instanceof \OCP\Files\Folder) { + if ($node instanceof Folder) { $result['item_type'] = 'folder'; } else { $result['item_type'] = 'file'; @@ -166,6 +171,9 @@ private function formatShare(IShare $share): array { /** * @NoAdminRequired + * + * @psalm-import-type DeletedShareItem from ResponseDefinitions + * @return DataResponse 200 */ public function index(): DataResponse { $groupShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_GROUP, null, -1, 0); @@ -184,7 +192,9 @@ public function index(): DataResponse { /** * @NoAdminRequired * + * @return DataResponse 200 * @throws OCSException + * @throws OCSNotFoundException */ public function undelete(string $id): DataResponse { try { @@ -229,7 +239,7 @@ private function getRoomShareHelper() { * If the Deck application is not enabled or the helper is not available * a QueryException is thrown instead. * - * @return \OCA\Deck\Sharing\ShareAPIHelper + * @return ShareAPIHelper * @throws QueryException */ private function getDeckShareHelper() { diff --git a/apps/files_sharing/lib/Controller/RemoteController.php b/apps/files_sharing/lib/Controller/RemoteController.php index 47523e08639d4..4b003f2548ff7 100644 --- a/apps/files_sharing/lib/Controller/RemoteController.php +++ b/apps/files_sharing/lib/Controller/RemoteController.php @@ -5,6 +5,7 @@ * @author Bjoern Schiessle * @author Joas Schilling * @author Roeland Jago Douma + * @author Kate Döen * * @license AGPL-3.0 * @@ -21,9 +22,13 @@ * along with this program. If not, see * */ + namespace OCA\Files_Sharing\Controller; +use OC\Files\View; +use OC_User; use OCA\Files_Sharing\External\Manager; +use OCA\Files_Sharing\ResponseDefinitions; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\AppFramework\OCS\OCSNotFoundException; @@ -49,9 +54,9 @@ class RemoteController extends OCSController { * @param Manager $externalManager */ public function __construct($appName, - IRequest $request, - Manager $externalManager, - ILogger $logger) { + IRequest $request, + Manager $externalManager, + ILogger $logger) { parent::__construct($appName, $request); $this->externalManager = $externalManager; @@ -63,7 +68,8 @@ public function __construct($appName, * * Get list of pending remote shares * - * @return DataResponse + * @psalm-import-type RemoteShareItem from ResponseDefinitions + * @return DataResponse 200 */ public function getOpenShares() { return new DataResponse($this->externalManager->getOpenShares()); @@ -75,10 +81,10 @@ public function getOpenShares() { * Accept a remote share * * @param int $id - * @return DataResponse + * @return DataResponse 200 * @throws OCSNotFoundException */ - public function acceptShare($id) { + public function acceptShare(int $id) { if ($this->externalManager->acceptShare($id)) { return new DataResponse(); } @@ -95,10 +101,10 @@ public function acceptShare($id) { * Decline a remote share * * @param int $id - * @return DataResponse + * @return DataResponse 200 * @throws OCSNotFoundException */ - public function declineShare($id) { + public function declineShare(int $id) { if ($this->externalManager->declineShare($id)) { return new DataResponse(); } @@ -114,7 +120,7 @@ public function declineShare($id) { * @return array enriched share info with data from the filecache */ private static function extendShareInfo($share) { - $view = new \OC\Files\View('/' . \OC_User::getUser() . '/files/'); + $view = new View('/' . OC_User::getUser() . '/files/'); $info = $view->getFileInfo($share['mountpoint']); if ($info === false) { @@ -135,7 +141,8 @@ private static function extendShareInfo($share) { * * List accepted remote shares * - * @return DataResponse + * @psalm-import-type RemoteShareItem from ResponseDefinitions + * @return DataResponse 200 */ public function getShares() { $shares = $this->externalManager->getAcceptedShares(); @@ -150,10 +157,11 @@ public function getShares() { * Get info of a remote share * * @param int $id - * @return DataResponse + * @psalm-import-type RemoteShareItem from ResponseDefinitions + * @return DataResponse 200 * @throws OCSNotFoundException */ - public function getShare($id) { + public function getShare(int $id) { $shareInfo = $this->externalManager->getShare($id); if ($shareInfo === false) { @@ -170,18 +178,18 @@ public function getShare($id) { * Unshare a remote share * * @param int $id - * @return DataResponse + * @return DataResponse 200 * @throws OCSNotFoundException * @throws OCSForbiddenException */ - public function unshare($id) { + public function unshare(int $id) { $shareInfo = $this->externalManager->getShare($id); if ($shareInfo === false) { throw new OCSNotFoundException('Share does not exist'); } - $mountPoint = '/' . \OC_User::getUser() . '/files' . $shareInfo['mountpoint']; + $mountPoint = '/' . OC_User::getUser() . '/files' . $shareInfo['mountpoint']; if ($this->externalManager->removeShare($mountPoint) === true) { return new DataResponse(); diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index ab318a81fc232..5d6a5bc9f94c3 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -26,6 +26,7 @@ * @author Valdnet <47037905+Valdnet@users.noreply.github.com> * @author Vincent Petry * @author waleczny + * @author Kate Döen * * @license AGPL-3.0 * @@ -42,14 +43,21 @@ * along with this program. If not, see * */ + namespace OCA\Files_Sharing\Controller; +use DateTime; +use Exception; +use OC; use OC\Files\FileInfo; use OC\Files\Storage\Wrapper\Wrapper; +use OCA\Circles\Api\v1\Circles; +use OCA\Deck\Sharing\ShareAPIHelper; +use OCA\Files\Helper; use OCA\Files_Sharing\Exceptions\SharingRightsException; use OCA\Files_Sharing\External\Storage; +use OCA\Files_Sharing\ResponseDefinitions; use OCA\Files_Sharing\SharedStorage; -use OCA\Files\Helper; use OCP\App\IAppManager; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSBadRequestException; @@ -59,9 +67,10 @@ use OCP\AppFramework\OCSController; use OCP\AppFramework\QueryException; use OCP\Constants; +use OCP\Files\File; +use OCP\Files\Folder; use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; -use OCP\Files\Folder; use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\IConfig; @@ -74,12 +83,14 @@ use OCP\IUserManager; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; -use OCP\Share; use OCP\Share\Exceptions\GenericShareException; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; use OCP\Share\IShare; use OCP\UserStatus\IManager as IUserStatusManager; +use RuntimeException; +use function json_decode; +use function json_encode; /** * Class Share20OCS @@ -102,7 +113,7 @@ class ShareAPIController extends OCSController { private $currentUser; /** @var IL10N */ private $l; - /** @var \OCP\Files\Node */ + /** @var Node */ private $lockedNode; /** @var IConfig */ private $config; @@ -168,7 +179,7 @@ public function __construct( /** * Convert an IShare to an array for OCS output * - * @param \OCP\Share\IShare $share + * @param IShare $share * @param Node|null $recipientNode * @return array * @throws NotFoundException In case the node can't be resolved. @@ -241,7 +252,7 @@ protected function formatShare(IShare $share, Node $recipientNode = null): array $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith(); $result['share_with_displayname_unique'] = $sharedWith !== null ? ( - !empty($sharedWith->getSystemEMailAddress()) ? $sharedWith->getSystemEMailAddress() : $sharedWith->getUID() + !empty($sharedWith->getSystemEMailAddress()) ? $sharedWith->getSystemEMailAddress() : $sharedWith->getUID() ) : $share->getSharedWith(); $result['status'] = []; @@ -281,7 +292,7 @@ protected function formatShare(IShare $share, Node $recipientNode = null): array } elseif ($share->getShareType() === IShare::TYPE_EMAIL) { $result['share_with'] = $share->getSharedWith(); $result['password'] = $share->getPassword(); - $result['password_expiration_time'] = $share->getPasswordExpirationTime() !== null ? $share->getPasswordExpirationTime()->format(\DateTime::ATOM) : null; + $result['password_expiration_time'] = $share->getPasswordExpirationTime() !== null ? $share->getPasswordExpirationTime()->format(DateTime::ATOM) : null; $result['send_password_by_talk'] = $share->getSendPasswordByTalk(); $result['share_with_displayname'] = $this->getDisplayNameFromAddressBook($share->getSharedWith(), 'EMAIL'); $result['token'] = $share->getToken(); @@ -328,7 +339,7 @@ protected function formatShare(IShare $share, Node $recipientNode = null): array $result['attributes'] = null; if ($attributes = $share->getAttributes()) { - $result['attributes'] = \json_encode($attributes->toArray()); + $result['attributes'] = json_encode($attributes->toArray()); } return $result; @@ -344,7 +355,7 @@ protected function formatShare(IShare $share, Node $recipientNode = null): array */ private function getDisplayNameFromAddressBook(string $query, string $property): string { // FIXME: If we inject the contacts manager it gets initialized before any address books are registered - $result = \OC::$server->getContactsManager()->search($query, [$property], [ + $result = OC::$server->getContactsManager()->search($query, [$property], [ 'limit' => 1, 'enumeration' => false, 'strict_search' => true, @@ -366,8 +377,9 @@ private function getDisplayNameFromAddressBook(string $query, string $property): * @NoAdminRequired * * @param string $id - * @param bool $includeTags - * @return DataResponse + * @param bool $include_tags + * @psalm-import-type ShareItem from ResponseDefinitions + * @return DataResponse 200 * @throws OCSNotFoundException */ public function getShare(string $id, bool $include_tags = false): DataResponse { @@ -382,7 +394,7 @@ public function getShare(string $id, bool $include_tags = false): DataResponse { $share = $this->formatShare($share); if ($include_tags) { - $share = Helper::populateTags([$share], 'file_source', \OC::$server->getTagManager()); + $share = Helper::populateTags([$share], 'file_source', OC::$server->getTagManager()); } else { $share = [$share]; } @@ -402,8 +414,9 @@ public function getShare(string $id, bool $include_tags = false): DataResponse { * @NoAdminRequired * * @param string $id - * @return DataResponse + * @return DataResponse 200 * @throws OCSNotFoundException + * @throws OCSForbiddenException */ public function deleteShare(string $id): DataResponse { try { @@ -442,24 +455,23 @@ public function deleteShare(string $id): DataResponse { /** * @NoAdminRequired * - * @param string $path - * @param int $permissions + * @param string|null $path + * @param int|null $permissions * @param int $shareType - * @param string $shareWith + * @param string|null $shareWith * @param string $publicUpload * @param string $password - * @param string $sendPasswordByTalk + * @param string|null $sendPasswordByTalk * @param string $expireDate * @param string $label - * @param string $attributes + * @param string|null $attributes * - * @return DataResponse - * @throws NotFoundException + * @psalm-import-type ShareItem from ResponseDefinitions + * @return DataResponse 200 * @throws OCSBadRequestException * @throws OCSException * @throws OCSForbiddenException * @throws OCSNotFoundException - * @throws InvalidPathException * @suppress PhanUndeclaredClassMethod */ public function createShare( @@ -495,7 +507,7 @@ public function createShare( $userFolder = $this->rootFolder->getUserFolder($this->currentUser); try { - /** @var \OC\Files\Node\Node $node */ + /** @var OC\Files\Node\Node $node */ $node = $userFolder->get($path); } catch (NotFoundException $e) { throw new OCSNotFoundException($this->l->t('Wrong path, file/folder does not exist')); @@ -525,7 +537,7 @@ public function createShare( // Shares always require read permissions $permissions |= Constants::PERMISSION_READ; - if ($node instanceof \OCP\Files\File) { + if ($node instanceof File) { // Single file shares should never have delete or create permissions $permissions &= ~Constants::PERMISSION_DELETE; $permissions &= ~Constants::PERMISSION_CREATE; @@ -580,7 +592,7 @@ public function createShare( } // Public upload can only be set for folders - if ($node instanceof \OCP\Files\File) { + if ($node instanceof File) { throw new OCSNotFoundException($this->l->t('Public upload is only possible for publicly shared folders')); } @@ -625,7 +637,7 @@ public function createShare( try { $expireDate = $this->parseDate($expireDate); $share->setExpirationDate($expireDate); - } catch (\Exception $e) { + } catch (Exception $e) { throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); } } @@ -644,7 +656,7 @@ public function createShare( try { $expireDate = $this->parseDate($expireDate); $share->setExpirationDate($expireDate); - } catch (\Exception $e) { + } catch (Exception $e) { throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); } } @@ -663,16 +675,16 @@ public function createShare( try { $expireDate = $this->parseDate($expireDate); $share->setExpirationDate($expireDate); - } catch (\Exception $e) { + } catch (Exception $e) { throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); } } } elseif ($shareType === IShare::TYPE_CIRCLE) { - if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) { + if (!OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) { throw new OCSNotFoundException($this->l->t('You cannot share to a Circle if the app is not enabled')); } - $circle = \OCA\Circles\Api\v1\Circles::detailsCircle($shareWith); + $circle = Circles::detailsCircle($shareWith); // Valid circle is required to share if ($circle === null) { @@ -705,11 +717,11 @@ public function createShare( try { $share = $this->shareManager->createShare($share); } catch (GenericShareException $e) { - \OC::$server->getLogger()->logException($e); + OC::$server->getLogger()->logException($e); $code = $e->getCode() === 0 ? 403 : $e->getCode(); throw new OCSException($e->getHint(), $code); - } catch (\Exception $e) { - \OC::$server->getLogger()->logException($e); + } catch (Exception $e) { + OC::$server->getLogger()->logException($e); throw new OCSForbiddenException($e->getMessage(), $e); } @@ -749,27 +761,27 @@ private function getSharedWithMe($node, bool $includeTags): array { } if ($includeTags) { - $formatted = Helper::populateTags($formatted, 'file_source', \OC::$server->getTagManager()); + $formatted = Helper::populateTags($formatted, 'file_source', OC::$server->getTagManager()); } return $formatted; } /** - * @param \OCP\Files\Node $folder + * @param Node $folder * * @return array * @throws OCSBadRequestException * @throws NotFoundException */ private function getSharesInDir(Node $folder): array { - if (!($folder instanceof \OCP\Files\Folder)) { + if (!($folder instanceof Folder)) { throw new OCSBadRequestException($this->l->t('Not a directory')); } $nodes = $folder->getDirectoryListing(); - /** @var \OCP\Share\IShare[] $shares */ + /** @var IShare[] $shares */ $shares = array_reduce($nodes, function ($carry, $node) { $carry = array_merge($carry, $this->getAllShares($node, true)); return $carry; @@ -798,7 +810,7 @@ private function getSharesInDir(Node $folder): array { if (!$resharingRight && $this->shareProviderResharingRights($this->currentUser, $share, $folder)) { $resharingRight = true; } - } catch (\Exception $e) { + } catch (Exception $e) { //Ignore this share } } @@ -828,9 +840,8 @@ private function getSharesInDir(Node $folder): array { * * @param string $include_tags * - * @return DataResponse - * @throws NotFoundException - * @throws OCSBadRequestException + * @psalm-import-type ShareItem from ResponseDefinitions + * @return DataResponse 200 * @throws OCSNotFoundException */ public function getShares( @@ -934,7 +945,7 @@ private function getFormattedShares( if (!$resharingRight && $this->shareProviderResharingRights($this->currentUser, $share, $node)) { $resharingRight = true; } - } catch (InvalidPathException | NotFoundException $e) { + } catch (InvalidPathException|NotFoundException $e) { } } @@ -944,7 +955,7 @@ private function getFormattedShares( if ($includeTags) { $formatted = - Helper::populateTags($formatted, 'file_source', \OC::$server->getTagManager()); + Helper::populateTags($formatted, 'file_source', OC::$server->getTagManager()); } return $formatted; @@ -965,11 +976,11 @@ private function getFormattedShares( * - Get shares for a specific path (?path=...) * - Get all shares in a folder (?subfiles=true&path=..) * - * @return DataResponse + * @psalm-import-type ShareItem from ResponseDefinitions + * @return DataResponse 200 * @throws InvalidPathException * @throws NotFoundException * @throws OCSNotFoundException - * @throws OCSBadRequestException * @throws SharingRightsException */ public function getInheritedShares(string $path): DataResponse { @@ -979,7 +990,7 @@ public function getInheritedShares(string $path): DataResponse { try { $node = $userFolder->get($path); $this->lock($node); - } catch (\OCP\Files\NotFoundException $e) { + } catch (NotFoundException $e) { throw new OCSNotFoundException($this->l->t('Wrong path, file/folder does not exist')); } catch (LockedException $e) { throw new OCSNotFoundException($this->l->t('Could not lock path')); @@ -994,7 +1005,7 @@ public function getInheritedShares(string $path): DataResponse { // initiate real owner. $owner = $node->getOwner() - ->getUID(); + ->getUID(); if (!$this->userManager->userExists($owner)) { return new DataResponse([]); } @@ -1003,7 +1014,7 @@ public function getInheritedShares(string $path): DataResponse { $userFolder = $this->rootFolder->getUserFolder($owner); if ($node->getId() !== $userFolder->getId() && !$userFolder->isSubNode($node)) { $owner = $node->getOwner() - ->getUID(); + ->getUID(); $userFolder = $this->rootFolder->getUserFolder($owner); $nodes = $userFolder->getById($node->getId()); $node = array_shift($nodes); @@ -1055,18 +1066,17 @@ private function hasPermission(int $permissionsSet, int $permissionsToCheck): bo * @NoAdminRequired * * @param string $id - * @param int $permissions - * @param string $password - * @param string $sendPasswordByTalk - * @param string $publicUpload - * @param string $expireDate - * @param string $note - * @param string $label - * @param string $hideDownload - * @param string $attributes - * @return DataResponse - * @throws LockedException - * @throws NotFoundException + * @param int|null $permissions + * @param string|null $password + * @param string|null $sendPasswordByTalk + * @param string|null $publicUpload + * @param string|null $expireDate + * @param string|null $note + * @param string|null $label + * @param string|null $hideDownload + * @param string|null $attributes + * @psalm-import-type ShareItem from ResponseDefinitions + * @return DataResponse 200 * @throws OCSBadRequestException * @throws OCSForbiddenException * @throws OCSNotFoundException @@ -1181,7 +1191,7 @@ public function updateShare( throw new OCSForbiddenException($this->l->t('Public upload disabled by the administrator')); } - if (!($share->getNode() instanceof \OCP\Files\Folder)) { + if (!($share->getNode() instanceof Folder)) { throw new OCSBadRequestException($this->l->t('Public upload is only possible for publicly shared folders')); } @@ -1206,7 +1216,7 @@ public function updateShare( } elseif ($expireDate !== null) { try { $expireDate = $this->parseDate($expireDate); - } catch (\Exception $e) { + } catch (Exception $e) { throw new OCSBadRequestException($e->getMessage(), $e); } $share->setExpirationDate($expireDate); @@ -1234,9 +1244,7 @@ public function updateShare( } elseif ($sendPasswordByTalk !== null) { $share->setSendPasswordByTalk(false); } - } - - // NOT A LINK SHARE + } // NOT A LINK SHARE else { if ($permissions !== null) { $share->setPermissions($permissions); @@ -1247,7 +1255,7 @@ public function updateShare( } elseif ($expireDate !== null) { try { $expireDate = $this->parseDate($expireDate); - } catch (\Exception $e) { + } catch (Exception $e) { throw new OCSBadRequestException($e->getMessage(), $e); } $share->setExpirationDate($expireDate); @@ -1259,7 +1267,7 @@ public function updateShare( } catch (GenericShareException $e) { $code = $e->getCode() === 0 ? 403 : $e->getCode(); throw new OCSException($e->getHint(), (int)$code); - } catch (\Exception $e) { + } catch (Exception $e) { throw new OCSBadRequestException($e->getMessage(), $e); } @@ -1268,6 +1276,9 @@ public function updateShare( /** * @NoAdminRequired + * + * @psalm-import-type ShareItem from ResponseDefinitions + * @return DataResponse 200 */ public function pendingShares(): DataResponse { $pendingShares = []; @@ -1320,7 +1331,7 @@ public function pendingShares(): DataResponse { * @NoAdminRequired * * @param string $id - * @return DataResponse + * @return DataResponse 200 * @throws OCSNotFoundException * @throws OCSException * @throws OCSBadRequestException @@ -1341,7 +1352,7 @@ public function acceptShare(string $id): DataResponse { } catch (GenericShareException $e) { $code = $e->getCode() === 0 ? 403 : $e->getCode(); throw new OCSException($e->getHint(), (int)$code); - } catch (\Exception $e) { + } catch (Exception $e) { throw new OCSBadRequestException($e->getMessage(), $e); } @@ -1351,14 +1362,14 @@ public function acceptShare(string $id): DataResponse { /** * Does the user have read permission on the share * - * @param \OCP\Share\IShare $share the share to check + * @param IShare $share the share to check * @param boolean $checkGroups check groups as well? * @return boolean * @throws NotFoundException * * @suppress PhanUndeclaredClassMethod */ - protected function canAccessShare(\OCP\Share\IShare $share, bool $checkGroups = true): bool { + protected function canAccessShare(IShare $share, bool $checkGroups = true): bool { // A file with permissions 0 can't be accessed by us. So Don't show it if ($share->getPermissions() === 0) { return false; @@ -1420,10 +1431,10 @@ protected function canAccessShare(\OCP\Share\IShare $share, bool $checkGroups = /** * Does the user have edit permission on the share * - * @param \OCP\Share\IShare $share the share to check + * @param IShare $share the share to check * @return boolean */ - protected function canEditShare(\OCP\Share\IShare $share): bool { + protected function canEditShare(IShare $share): bool { // A file with permissions 0 can't be accessed by us. So Don't show it if ($share->getPermissions() === 0) { return false; @@ -1447,10 +1458,10 @@ protected function canEditShare(\OCP\Share\IShare $share): bool { /** * Does the user have delete permission on the share * - * @param \OCP\Share\IShare $share the share to check + * @param IShare $share the share to check * @return boolean */ - protected function canDeleteShare(\OCP\Share\IShare $share): bool { + protected function canDeleteShare(IShare $share): bool { // A file with permissions 0 can't be accessed by us. So Don't show it if ($share->getPermissions() === 0) { return false; @@ -1482,12 +1493,12 @@ protected function canDeleteShare(\OCP\Share\IShare $share): bool { * completely delete the share but only the mount point. * It can then be restored from the deleted shares section. * - * @param \OCP\Share\IShare $share the share to check + * @param IShare $share the share to check * @return boolean * * @suppress PhanUndeclaredClassMethod */ - protected function canDeleteShareFromSelf(\OCP\Share\IShare $share): bool { + protected function canDeleteShareFromSelf(IShare $share): bool { if ($share->getShareType() !== IShare::TYPE_GROUP && $share->getShareType() !== IShare::TYPE_ROOM && $share->getShareType() !== IShare::TYPE_DECK @@ -1537,14 +1548,14 @@ protected function canDeleteShareFromSelf(\OCP\Share\IShare $share): bool { * * @param string $expireDate * - * @throws \Exception - * @return \DateTime + * @return DateTime + * @throws Exception */ - private function parseDate(string $expireDate): \DateTime { + private function parseDate(string $expireDate): DateTime { try { - $date = new \DateTime(trim($expireDate, "\"")); - } catch (\Exception $e) { - throw new \Exception('Invalid date. Format must be YYYY-MM-DD'); + $date = new DateTime(trim($expireDate, "\"")); + } catch (Exception $e) { + throw new Exception('Invalid date. Format must be YYYY-MM-DD'); } $date->setTime(0, 0, 0); @@ -1557,7 +1568,7 @@ private function parseDate(string $expireDate): \DateTime { * not support this we need to check all backends. * * @param string $id - * @return \OCP\Share\IShare + * @return IShare * @throws ShareNotFound */ private function getShareById(string $id): IShare { @@ -1617,10 +1628,10 @@ private function getShareById(string $id): IShare { /** * Lock a Node * - * @param \OCP\Files\Node $node + * @param Node $node * @throws LockedException */ - private function lock(\OCP\Files\Node $node) { + private function lock(Node $node) { $node->lock(ILockingProvider::LOCK_SHARED); $this->lockedNode = $node; } @@ -1658,7 +1669,7 @@ private function getRoomShareHelper() { * If the Deck application is not enabled or the helper is not available * a QueryException is thrown instead. * - * @return \OCA\Deck\Sharing\ShareAPIHelper + * @return ShareAPIHelper * @throws QueryException */ private function getDeckShareHelper() { @@ -1747,7 +1758,7 @@ private function hasResharingRights($viewer, $node): bool { if ($this->shareProviderResharingRights($viewer, $share, $node)) { return true; } - } catch (InvalidPathException | NotFoundException $e) { + } catch (InvalidPathException|NotFoundException $e) { } } } @@ -1779,7 +1790,7 @@ private function shareProviderResharingRights(string $userId, IShare $share, $no return true; } - if ((\OCP\Constants::PERMISSION_SHARE & $share->getPermissions()) === 0) { + if ((Constants::PERMISSION_SHARE & $share->getPermissions()) === 0) { return false; } @@ -1791,7 +1802,7 @@ private function shareProviderResharingRights(string $userId, IShare $share, $no return true; } - if ($share->getShareType() === IShare::TYPE_CIRCLE && \OC::$server->getAppManager()->isEnabledForUser('circles') + if ($share->getShareType() === IShare::TYPE_CIRCLE && OC::$server->getAppManager()->isEnabledForUser('circles') && class_exists('\OCA\Circles\Api\v1\Circles')) { $hasCircleId = (substr($share->getSharedWith(), -1) === ']'); $shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0); @@ -1802,7 +1813,7 @@ private function shareProviderResharingRights(string $userId, IShare $share, $no $sharedWith = substr($share->getSharedWith(), $shareWithStart, $shareWithLength); } try { - $member = \OCA\Circles\Api\v1\Circles::getMember($sharedWith, $userId, 1); + $member = Circles::getMember($sharedWith, $userId, 1); if ($member->getLevel() >= 4) { return true; } @@ -1880,13 +1891,13 @@ private function setShareAttributes(IShare $share, ?string $attributesString) { $newShareAttributes = null; if ($attributesString !== null) { $newShareAttributes = $this->shareManager->newShare()->newAttributes(); - $formattedShareAttributes = \json_decode($attributesString, true); + $formattedShareAttributes = json_decode($attributesString, true); if (is_array($formattedShareAttributes)) { foreach ($formattedShareAttributes as $formattedAttr) { $newShareAttributes->setAttribute( $formattedAttr['scope'], $formattedAttr['key'], - is_string($formattedAttr['enabled']) ? (bool) \json_decode($formattedAttr['enabled']) : $formattedAttr['enabled'] + is_string($formattedAttr['enabled']) ? (bool)json_decode($formattedAttr['enabled']) : $formattedAttr['enabled'] ); } } else { @@ -1913,12 +1924,12 @@ private function checkInheritedAttributes(IShare $share): void { if ($storage instanceof Wrapper) { $storage = $storage->getInstanceOfStorage(SharedStorage::class); if ($storage === null) { - throw new \RuntimeException('Should not happen, instanceOfStorage but getInstanceOfStorage return null'); + throw new RuntimeException('Should not happen, instanceOfStorage but getInstanceOfStorage return null'); } } else { - throw new \RuntimeException('Should not happen, instanceOfStorage but not a wrapper'); + throw new RuntimeException('Should not happen, instanceOfStorage but not a wrapper'); } - /** @var \OCA\Files_Sharing\SharedStorage $storage */ + /** @var SharedStorage $storage */ $inheritedAttributes = $storage->getShare()->getAttributes(); if ($inheritedAttributes !== null && $inheritedAttributes->getAttribute('permissions', 'download') === false) { $share->setHideDownload(true); diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 00e63ccb7b019..e07da75bd9d5e 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -19,6 +19,7 @@ * @author Morris Jobke * @author Robin Appelman * @author Roeland Jago Douma + * @author Kate Döen * * @license AGPL-3.0 * @@ -35,24 +36,29 @@ * along with this program. If not, see * */ + namespace OCA\Files_Sharing\Controller; -use OCP\Constants; -use function array_slice; -use function array_values; +use Exception; use Generator; +use OC; use OC\Collaboration\Collaborators\SearchResult; +use OC\Share\Share; +use OCA\Files_Sharing\ResponseDefinitions; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSBadRequestException; use OCP\AppFramework\OCSController; use OCP\Collaboration\Collaborators\ISearch; use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Collaboration\Collaborators\SearchResultType; +use OCP\Constants; use OCP\IConfig; use OCP\IRequest; use OCP\IURLGenerator; -use OCP\Share\IShare; use OCP\Share\IManager; +use OCP\Share\IShare; +use function array_slice; +use function array_values; use function usort; class ShareesAPIController extends OCSController { @@ -133,15 +139,16 @@ public function __construct( * @NoAdminRequired * * @param string $search - * @param string $itemType + * @param string|null $itemType * @param int $page * @param int $perPage - * @param int|int[] $shareType + * @param int|int[]|null $shareType * @param bool $lookup - * @return DataResponse + * @psalm-import-type ShareesSearchResult from ResponseDefinitions + * @return DataResponse 200 * @throws OCSBadRequestException */ - public function search(string $search = '', string $itemType = null, int $page = 1, int $perPage = 200, $shareType = null, bool $lookup = false): DataResponse { + public function search(string $search = '', string $itemType = null, int $page = 1, int $perPage = 200, int|array $shareType = null, bool $lookup = false): DataResponse { // only search for string larger than a given threshold $threshold = $this->config->getSystemValueInt('sharing.minSearchStringLength', 0); @@ -199,7 +206,7 @@ public function search(string $search = '', string $itemType = null, int $page = } // FIXME: DI - if (\OC::$server->getAppManager()->isEnabledForUser('circles') && class_exists('\OCA\Circles\ShareByCircleProvider')) { + if (OC::$server->getAppManager()->isEnabledForUser('circles') && class_exists('\OCA\Circles\ShareByCircleProvider')) { $shareTypes[] = IShare::TYPE_CIRCLE; } @@ -210,7 +217,7 @@ public function search(string $search = '', string $itemType = null, int $page = if ($shareType !== null && is_array($shareType)) { $shareTypes = array_intersect($shareTypes, $shareType); } elseif (is_numeric($shareType)) { - $shareTypes = array_intersect($shareTypes, [(int) $shareType]); + $shareTypes = array_intersect($shareTypes, [(int)$shareType]); } sort($shareTypes); @@ -334,11 +341,13 @@ private function getAllSharees(string $user, array $shareTypes): ISearchResult { /** * @NoAdminRequired * - * @param string $itemType - * @return DataResponse + * @param string|null $itemType + * @param int|int[]|null $shareType + * @psalm-import-type ShareesRecommendedResult from ResponseDefinitions + * @return DataResponse 200 * @throws OCSBadRequestException */ - public function findRecommended(string $itemType = null, $shareType = null): DataResponse { + public function findRecommended(string $itemType = null, int|array $shareType = null): DataResponse { $shareTypes = [ IShare::TYPE_USER, ]; @@ -371,7 +380,7 @@ public function findRecommended(string $itemType = null, $shareType = null): Dat } // FIXME: DI - if (\OC::$server->getAppManager()->isEnabledForUser('circles') && class_exists('\OCA\Circles\ShareByCircleProvider')) { + if (OC::$server->getAppManager()->isEnabledForUser('circles') && class_exists('\OCA\Circles\ShareByCircleProvider')) { $shareTypes[] = IShare::TYPE_CIRCLE; } @@ -379,7 +388,7 @@ public function findRecommended(string $itemType = null, $shareType = null): Dat $shareTypes = array_intersect($shareTypes, $_GET['shareType']); sort($shareTypes); } elseif (is_numeric($shareType)) { - $shareTypes = array_intersect($shareTypes, [(int) $shareType]); + $shareTypes = array_intersect($shareTypes, [(int)$shareType]); sort($shareTypes); } @@ -397,9 +406,9 @@ public function findRecommended(string $itemType = null, $shareType = null): Dat protected function isRemoteSharingAllowed(string $itemType): bool { try { // FIXME: static foo makes unit testing unnecessarily difficult - $backend = \OC\Share\Share::getBackend($itemType); + $backend = Share::getBackend($itemType); return $backend->isShareTypeAllowed(IShare::TYPE_REMOTE); - } catch (\Exception $e) { + } catch (Exception $e) { return false; } } @@ -407,9 +416,9 @@ protected function isRemoteSharingAllowed(string $itemType): bool { protected function isRemoteGroupSharingAllowed(string $itemType): bool { try { // FIXME: static foo makes unit testing unnecessarily difficult - $backend = \OC\Share\Share::getBackend($itemType); + $backend = Share::getBackend($itemType); return $backend->isShareTypeAllowed(IShare::TYPE_REMOTE_GROUP); - } catch (\Exception $e) { + } catch (Exception $e) { return false; } } diff --git a/apps/files_sharing/lib/ResponseDefinitions.php b/apps/files_sharing/lib/ResponseDefinitions.php new file mode 100644 index 0000000000000..d0e15a569b3d2 --- /dev/null +++ b/apps/files_sharing/lib/ResponseDefinitions.php @@ -0,0 +1,221 @@ + + * + * @author Kate Döen + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Files_Sharing; + +/** + * @psalm-type ShareItem = array{ + * attributes: string|null, + * can_delete: bool, + * can_edit: bool, + * displayname_file_owner: string, + * displayname_owner: string, + * expiration: string|null, + * file_parent: int, + * file_source: int, + * file_target: string, + * has_preview: bool, + * id: string, + * item_source: int, + * item_type: string, + * label: string, + * mail_send: int, + * mimetype: string, + * note: string, + * password: string|null, + * password_expiration_time: string|null, + * path: string, + * permissions: int, + * send_password_by_talk: bool|null, + * share_type: int, + * share_with: string|null, + * share_with_avatar: string|null, + * share_with_displayname: string|null, + * share_with_link: string|null, + * status: array{status: string, message: string|null, icon: string|null, clearAt: int|null}|int|null, + * stime: int, + * storage: int, + * storage_id: string, + * token: string|null, + * uid_file_owner: string, + * uid_owner: string, + * url: string|null, + * } + * + * @psalm-type DeletedShareItem = array{ + * id: string, + * share_type: int, + * uid_owner: string, + * displayname_owner: string, + * permissions: int, + * stime: int, + * uid_file_owner: string, + * displayname_file_owner: string, + * path: string, + * item_type: string, + * mimetype: string, + * storage: int, + * item_source: int, + * file_source: int, + * file_parent: int, + * file_target: int, + * expiration: string|null, + * share_with: string|null, + * share_with_displayname: string|null, + * share_with_link: string|null, + * } + * + * @psalm-type RemoteShareItem = array{ + * accepted: bool, + * file_id: int|null, + * id: int, + * mimetype: string|null, + * mountpoint: string, + * mtime: int|null, + * name: string, + * owner: string, + * parent: int|null, + * permissions: int|null, + * remote: string, + * remote_id: string, + * share_token: string, + * share_type: int, + * type: string|null, + * user: string, + * } + * + * @psalm-type Sharee = array{ + * count: int|null, + * label: string, + * value: array{ + * shareType: int, + * shareWith: string, + * } + * } + * + * @psalm-type ShareeUser = Sharee&array{ + * subline: string, + * icon: string, + * shareWithDisplayNameUnique: string, + * status: array{ + * status: string, + * message: string, + * icon: string, + * clearAt: int|null, + * } + * } + * + * @psalm-type ShareeRemoteGroup = Sharee&array{ + * guid: string, + * name: string, + * value: array{ + * server: string, + * } + * } + * + * @psalm-type Lookup = array{ + * value: string, + * verified: int, + * } + * + * @psalm-type ShareeLookup = Sharee&array{ + * extra: array{ + * federationId: string, + * name: Lookup|null, + * email: Lookup|null, + * address: Lookup|null, + * website: Lookup|null, + * twitter: Lookup|null, + * phone: Lookup|null, + * twitter_signature: Lookup|null, + * website_signature: Lookup|null, + * userid: Lookup|null, + * }, + * value: array{ + * globalScale: bool, + * } + * } + * + * @psalm-type ShareeEmail = Sharee&array{ + * uuid: string, + * name: string, + * type: string, + * shareWithDisplayNameUnique: string, + * } + * + * @psalm-type ShareeRemote = Sharee&array{ + * uuid: string, + * name: string, + * type: string, + * value: array{ + * server: string, + * } + * } + * + * @psalm-type ShareeCircle = Sharee&array{ + * shareWithDescription: string, + * value: array{ + * circle: string, + * } + * } + * + * @psalm-type ShareesSearchResult = array{ + * exact: array{ + * circles: ShareeCircle[], + * emails: ShareeEmail[], + * groups: Sharee[], + * remote_groups: ShareeRemoteGroup[], + * remotes: ShareeRemote[], + * rooms: Sharee[], + * users: ShareeUser[], + * }, + * circles: ShareeCircle[], + * emails: ShareeEmail[], + * groups: Sharee[], + * lookup: ShareeLookup[], + * remote_groups: ShareeRemoteGroup[], + * remotes: ShareeRemote[], + * rooms: Sharee[], + * users: ShareeUser[], + * lookupEnabled: bool, + * } + * + * @psalm-type ShareesRecommendedResult = array{ + * exact: array{ + * emails: ShareeEmail[], + * groups: Sharee[], + * remote_groups: ShareeRemoteGroup[], + * remotes: ShareeRemote[], + * users: ShareeUser[], + * }, + * emails: ShareeEmail[], + * groups: Sharee[], + * remote_groups: ShareeRemoteGroup[], + * remotes: ShareeRemote[], + * users: ShareeUser[], + * } + */ +class ResponseDefinitions { +} diff --git a/apps/files_sharing/openapi.json b/apps/files_sharing/openapi.json new file mode 100644 index 0000000000000..3f8c75c771ae2 --- /dev/null +++ b/apps/files_sharing/openapi.json @@ -0,0 +1,2606 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "File sharing", + "description": "File sharing", + "license": { + "name": "agpl" + }, + "version": "1.18.0" + }, + "paths": { + "/ocs/v2.php/apps/files_sharing/api/v1/shares": { + "get": { + "tags": [ + "files_sharing" + ], + "summary": "The getShares function.", + "description": "- Get shares by the current user - Get shares by the current user and reshares (?reshares=true) - Get shares with the current user (?shared_with_me=true) - Get shares for a specific path (?path=...) - Get all shares in a folder (?subfiles=true&path=..)", + "operationId": "shareapi-get-shares", + "parameters": [ + { + "name": "shared_with_me", + "in": "query", + "schema": { + "type": "string", + "default": "false" + } + }, + { + "name": "reshares", + "in": "query", + "schema": { + "type": "string", + "default": "false" + } + }, + { + "name": "subfiles", + "in": "query", + "schema": { + "type": "string", + "default": "false" + } + }, + { + "name": "path", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "include_tags", + "in": "query", + "schema": { + "type": "string", + "default": "false" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareItem" + } + } + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "files_sharing" + ], + "description": "", + "operationId": "shareapi-create-share", + "parameters": [ + { + "name": "path", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "permissions", + "in": "query", + "schema": { + "type": "integer" + } + }, + { + "name": "shareType", + "in": "query", + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "shareWith", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "publicUpload", + "in": "query", + "schema": { + "type": "string", + "default": "false" + } + }, + { + "name": "password", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "sendPasswordByTalk", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "expireDate", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "note", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "label", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "attributes", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/ShareItem" + } + } + } + } + } + } + } + }, + "400": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + }, + "403": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/shares/inherited": { + "get": { + "tags": [ + "files_sharing" + ], + "summary": "The getInheritedShares function. returns all shares relative to a file, including parent folders shares rights.", + "description": "- Get shares by the current user - Get shares by the current user and reshares (?reshares=true) - Get shares with the current user (?shared_with_me=true) - Get shares for a specific path (?path=...) - Get all shares in a folder (?subfiles=true&path=..)", + "operationId": "shareapi-get-inherited-shares", + "parameters": [ + { + "name": "path", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareItem" + } + } + } + } + } + } + } + } + }, + "500": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/shares/pending": { + "get": { + "tags": [ + "files_sharing" + ], + "description": "", + "operationId": "shareapi-pending-shares", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareItem" + } + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/shares/{id}": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "get": { + "tags": [ + "files_sharing" + ], + "description": "Get a specific share by id", + "operationId": "shareapi-get-share", + "parameters": [ + { + "name": "include_tags", + "in": "query", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/ShareItem" + } + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "put": { + "tags": [ + "files_sharing" + ], + "description": "", + "operationId": "shareapi-update-share", + "parameters": [ + { + "name": "permissions", + "in": "query", + "schema": { + "type": "integer" + } + }, + { + "name": "password", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "sendPasswordByTalk", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "publicUpload", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "expireDate", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "note", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "label", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "hideDownload", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "attributes", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/ShareItem" + } + } + } + } + } + } + } + }, + "400": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + }, + "403": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "files_sharing" + ], + "description": "Delete a share", + "operationId": "shareapi-delete-share", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + }, + "403": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/shares/pending/{id}": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "post": { + "tags": [ + "files_sharing" + ], + "description": "", + "operationId": "shareapi-accept-share", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + }, + "400": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/deletedshares": { + "get": { + "tags": [ + "files_sharing" + ], + "description": "", + "operationId": "list-deleted-shareapis", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DeletedShareItem" + } + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/deletedshares/{id}": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "post": { + "tags": [ + "files_sharing" + ], + "description": "", + "operationId": "undelete-deleted-shareapi", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/sharees": { + "get": { + "tags": [ + "files_sharing" + ], + "description": "", + "operationId": "search-shareesapi", + "parameters": [ + { + "name": "search", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "itemType", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "perPage", + "in": "query", + "schema": { + "type": "integer", + "default": 200 + } + }, + { + "name": "shareType", + "in": "query", + "schema": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "array", + "items": { + "type": "integer" + } + } + ] + } + }, + { + "name": "lookup", + "in": "query", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/ShareesSearchResult" + } + } + } + } + } + } + } + }, + "400": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/sharees_recommended": { + "get": { + "tags": [ + "files_sharing" + ], + "description": "", + "operationId": "shareesapi-find-recommended", + "parameters": [ + { + "name": "itemType", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "shareType", + "in": "query", + "schema": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "array", + "items": { + "type": "integer" + } + } + ] + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/ShareesRecommendedResult" + } + } + } + } + } + } + } + }, + "400": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/remote_shares": { + "get": { + "tags": [ + "files_sharing" + ], + "description": "List accepted remote shares", + "operationId": "remote-get-shares", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RemoteShareItem" + } + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending": { + "get": { + "tags": [ + "files_sharing" + ], + "description": "Get list of pending remote shares", + "operationId": "remote-get-open-shares", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RemoteShareItem" + } + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/{id}": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "post": { + "tags": [ + "files_sharing" + ], + "description": "Accept a remote share", + "operationId": "remote-accept-share", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "files_sharing" + ], + "description": "Decline a remote share", + "operationId": "remote-decline-share", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/{id}": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "get": { + "tags": [ + "files_sharing" + ], + "description": "Get info of a remote share", + "operationId": "remote-get-share", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/RemoteShareItem" + } + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "files_sharing" + ], + "description": "Unshare a remote share", + "operationId": "unshare-remote", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + }, + "403": { + "description": "", + "content": { + "text/plain": { + "schema": { + "required": [ + "ocs" + ], + "type": "object", + "properties": { + "ocs": { + "required": [ + "meta", + "data" + ], + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "DeletedShareItem": { + "required": [ + "id", + "share_type", + "uid_owner", + "displayname_owner", + "permissions", + "stime", + "uid_file_owner", + "displayname_file_owner", + "path", + "item_type", + "mimetype", + "storage", + "item_source", + "file_source", + "file_parent", + "file_target" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "share_type": { + "type": "integer" + }, + "uid_owner": { + "type": "string" + }, + "displayname_owner": { + "type": "string" + }, + "permissions": { + "type": "integer" + }, + "stime": { + "type": "integer" + }, + "uid_file_owner": { + "type": "string" + }, + "displayname_file_owner": { + "type": "string" + }, + "path": { + "type": "string" + }, + "item_type": { + "type": "string" + }, + "mimetype": { + "type": "string" + }, + "storage": { + "type": "integer" + }, + "item_source": { + "type": "integer" + }, + "file_source": { + "type": "integer" + }, + "file_parent": { + "type": "integer" + }, + "file_target": { + "type": "integer" + }, + "expiration": { + "type": "string" + }, + "share_with": { + "type": "string" + }, + "share_with_displayname": { + "type": "string" + }, + "share_with_link": { + "type": "string" + } + } + }, + "Lookup": { + "required": [ + "value", + "verified" + ], + "type": "object", + "properties": { + "value": { + "type": "string" + }, + "verified": { + "type": "integer" + } + } + }, + "OCSMeta": { + "type": "object", + "required": [ + "status", + "statuscode" + ], + "properties": { + "status": { + "type": "string" + }, + "statuscode": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "totalitems": { + "type": "string" + }, + "itemsperpage": { + "type": "string" + } + } + }, + "RemoteShareItem": { + "required": [ + "accepted", + "id", + "mountpoint", + "name", + "owner", + "remote", + "remote_id", + "share_token", + "share_type", + "user" + ], + "type": "object", + "properties": { + "accepted": { + "type": "boolean" + }, + "file_id": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "mimetype": { + "type": "string" + }, + "mountpoint": { + "type": "string" + }, + "mtime": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "parent": { + "type": "integer" + }, + "permissions": { + "type": "integer" + }, + "remote": { + "type": "string" + }, + "remote_id": { + "type": "string" + }, + "share_token": { + "type": "string" + }, + "share_type": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "user": { + "type": "string" + } + } + }, + "ShareItem": { + "required": [ + "can_delete", + "can_edit", + "displayname_file_owner", + "displayname_owner", + "file_parent", + "file_source", + "file_target", + "has_preview", + "id", + "item_source", + "item_type", + "label", + "mail_send", + "mimetype", + "note", + "path", + "permissions", + "share_type", + "stime", + "storage", + "storage_id", + "uid_file_owner", + "uid_owner" + ], + "type": "object", + "properties": { + "attributes": { + "type": "string" + }, + "can_delete": { + "type": "boolean" + }, + "can_edit": { + "type": "boolean" + }, + "displayname_file_owner": { + "type": "string" + }, + "displayname_owner": { + "type": "string" + }, + "expiration": { + "type": "string" + }, + "file_parent": { + "type": "integer" + }, + "file_source": { + "type": "integer" + }, + "file_target": { + "type": "string" + }, + "has_preview": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "item_source": { + "type": "integer" + }, + "item_type": { + "type": "string" + }, + "label": { + "type": "string" + }, + "mail_send": { + "type": "integer" + }, + "mimetype": { + "type": "string" + }, + "note": { + "type": "string" + }, + "password": { + "type": "string" + }, + "password_expiration_time": { + "type": "string" + }, + "path": { + "type": "string" + }, + "permissions": { + "type": "integer" + }, + "send_password_by_talk": { + "type": "boolean" + }, + "share_type": { + "type": "integer" + }, + "share_with": { + "type": "string" + }, + "share_with_avatar": { + "type": "string" + }, + "share_with_displayname": { + "type": "string" + }, + "share_with_link": { + "type": "string" + }, + "status": { + "oneOf": [ + { + "required": [ + "status" + ], + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "message": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "clearAt": { + "type": "integer" + } + } + }, + { + "type": "integer" + } + ] + }, + "stime": { + "type": "integer" + }, + "storage": { + "type": "integer" + }, + "storage_id": { + "type": "string" + }, + "token": { + "type": "string" + }, + "uid_file_owner": { + "type": "string" + }, + "uid_owner": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, + "Sharee": { + "required": [ + "label", + "value" + ], + "type": "object", + "properties": { + "count": { + "type": "integer" + }, + "label": { + "type": "string" + }, + "value": { + "required": [ + "shareType", + "shareWith" + ], + "type": "object", + "properties": { + "shareType": { + "type": "integer" + }, + "shareWith": { + "type": "string" + } + } + } + } + }, + "ShareeCircle": { + "allOf": [ + { + "$ref": "#/components/schemas/Sharee" + }, + { + "required": [ + "shareWithDescription", + "value" + ], + "type": "object", + "properties": { + "shareWithDescription": { + "type": "string" + }, + "value": { + "required": [ + "circle" + ], + "type": "object", + "properties": { + "circle": { + "type": "string" + } + } + } + } + } + ] + }, + "ShareeEmail": { + "allOf": [ + { + "$ref": "#/components/schemas/Sharee" + }, + { + "required": [ + "uuid", + "name", + "type", + "shareWithDisplayNameUnique" + ], + "type": "object", + "properties": { + "uuid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "shareWithDisplayNameUnique": { + "type": "string" + } + } + } + ] + }, + "ShareeLookup": { + "allOf": [ + { + "$ref": "#/components/schemas/Sharee" + }, + { + "required": [ + "extra", + "value" + ], + "type": "object", + "properties": { + "extra": { + "required": [ + "federationId" + ], + "type": "object", + "properties": { + "federationId": { + "type": "string" + }, + "name": { + "$ref": "#/components/schemas/Lookup" + }, + "email": { + "$ref": "#/components/schemas/Lookup" + }, + "address": { + "$ref": "#/components/schemas/Lookup" + }, + "website": { + "$ref": "#/components/schemas/Lookup" + }, + "twitter": { + "$ref": "#/components/schemas/Lookup" + }, + "phone": { + "$ref": "#/components/schemas/Lookup" + }, + "twitter_signature": { + "$ref": "#/components/schemas/Lookup" + }, + "website_signature": { + "$ref": "#/components/schemas/Lookup" + }, + "userid": { + "$ref": "#/components/schemas/Lookup" + } + } + }, + "value": { + "required": [ + "globalScale" + ], + "type": "object", + "properties": { + "globalScale": { + "type": "boolean" + } + } + } + } + } + ] + }, + "ShareeRemote": { + "allOf": [ + { + "$ref": "#/components/schemas/Sharee" + }, + { + "required": [ + "uuid", + "name", + "type", + "value" + ], + "type": "object", + "properties": { + "uuid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "value": { + "required": [ + "server" + ], + "type": "object", + "properties": { + "server": { + "type": "string" + } + } + } + } + } + ] + }, + "ShareeRemoteGroup": { + "allOf": [ + { + "$ref": "#/components/schemas/Sharee" + }, + { + "required": [ + "guid", + "name", + "value" + ], + "type": "object", + "properties": { + "guid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "value": { + "required": [ + "server" + ], + "type": "object", + "properties": { + "server": { + "type": "string" + } + } + } + } + } + ] + }, + "ShareeUser": { + "allOf": [ + { + "$ref": "#/components/schemas/Sharee" + }, + { + "required": [ + "subline", + "icon", + "shareWithDisplayNameUnique", + "status" + ], + "type": "object", + "properties": { + "subline": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "shareWithDisplayNameUnique": { + "type": "string" + }, + "status": { + "required": [ + "status", + "message", + "icon" + ], + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "message": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "clearAt": { + "type": "integer" + } + } + } + } + } + ] + }, + "ShareesRecommendedResult": { + "required": [ + "exact", + "emails", + "groups", + "remote_groups", + "remotes", + "users" + ], + "type": "object", + "properties": { + "exact": { + "required": [ + "emails", + "groups", + "remote_groups", + "remotes", + "users" + ], + "type": "object", + "properties": { + "emails": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeEmail" + } + }, + "groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Sharee" + } + }, + "remote_groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeRemoteGroup" + } + }, + "remotes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeRemote" + } + }, + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeUser" + } + } + } + }, + "emails": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeEmail" + } + }, + "groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Sharee" + } + }, + "remote_groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeRemoteGroup" + } + }, + "remotes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeRemote" + } + }, + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeUser" + } + } + } + }, + "ShareesSearchResult": { + "required": [ + "exact", + "circles", + "emails", + "groups", + "lookup", + "remote_groups", + "remotes", + "rooms", + "users", + "lookupEnabled" + ], + "type": "object", + "properties": { + "exact": { + "required": [ + "circles", + "emails", + "groups", + "remote_groups", + "remotes", + "rooms", + "users" + ], + "type": "object", + "properties": { + "circles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeCircle" + } + }, + "emails": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeEmail" + } + }, + "groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Sharee" + } + }, + "remote_groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeRemoteGroup" + } + }, + "remotes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeRemote" + } + }, + "rooms": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Sharee" + } + }, + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeUser" + } + } + } + }, + "circles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeCircle" + } + }, + "emails": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeEmail" + } + }, + "groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Sharee" + } + }, + "lookup": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeLookup" + } + }, + "remote_groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeRemoteGroup" + } + }, + "remotes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeRemote" + } + }, + "rooms": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Sharee" + } + }, + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShareeUser" + } + }, + "lookupEnabled": { + "type": "boolean" + } + } + } + }, + "securitySchemes": { + "basic_auth": { + "type": "http", + "scheme": "basic" + } + } + }, + "security": [ + { + "basic_auth": [] + } + ], + "tags": [ + { + "name": "files_sharing" + } + ] +} \ No newline at end of file