From af074eb2b7c0e69fc918a4f3c8abe47b4ea698dd Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 17 Aug 2016 10:05:09 +0200 Subject: Move updateShare and getShares over to use proper parameters * Update tests --- apps/files_sharing/lib/API/Share20OCS.php | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'apps/files_sharing/lib') diff --git a/apps/files_sharing/lib/API/Share20OCS.php b/apps/files_sharing/lib/API/Share20OCS.php index b8b259ee430..3e91da37a7d 100644 --- a/apps/files_sharing/lib/API/Share20OCS.php +++ b/apps/files_sharing/lib/API/Share20OCS.php @@ -473,6 +473,11 @@ class Share20OCS extends OCSController { * * @NoAdminRequired * + * @param string $shared_with_me + * @param string $reshares + * @param string $subfiles + * @param string $path + * * - 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) @@ -482,11 +487,12 @@ class Share20OCS extends OCSController { * @return DataResponse * @throws OCSNotFoundException */ - public function getShares() { - $sharedWithMe = $this->request->getParam('shared_with_me', null); - $reshares = $this->request->getParam('reshares', null); - $subfiles = $this->request->getParam('subfiles'); - $path = $this->request->getParam('path', null); + public function getShares( + $shared_with_me = 'false', + $reshares = 'false', + $subfiles = 'false', + $path = null + ) { if ($path !== null) { $userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID()); @@ -500,7 +506,7 @@ class Share20OCS extends OCSController { } } - if ($sharedWithMe === 'true') { + if ($shared_with_me === 'true') { $result = $this->getSharedWithMe($path); return $result; } @@ -543,12 +549,22 @@ class Share20OCS extends OCSController { * @NoAdminRequired * * @param int $id + * @param int $permissions + * @param string $password + * @param string $publicUpload + * @param string $expireDate * @return DataResponse * @throws OCSNotFoundException * @throws OCSBadRequestException * @throws OCSForbiddenException */ - public function updateShare($id) { + public function updateShare( + $id, + $permissions = null, + $password = null, + $publicUpload = null, + $expireDate = null + ) { try { $share = $this->getShareById($id); } catch (ShareNotFound $e) { @@ -561,11 +577,6 @@ class Share20OCS extends OCSController { throw new OCSNotFoundException($this->l->t('Wrong share ID, share doesn\'t exist')); } - $permissions = $this->request->getParam('permissions', null); - $password = $this->request->getParam('password', null); - $publicUpload = $this->request->getParam('publicUpload', null); - $expireDate = $this->request->getParam('expireDate', null); - /* * expirationdate, password and publicUpload only make sense for link shares */ -- cgit v1.2.3