diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-26 14:58:41 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-03-22 19:43:23 +0100 |
commit | 00f48ec37ba90254aca4643b2627bb2ffc7bd1fb (patch) | |
tree | 3ee7bbe37e47bdfb6b199e4b2f7ce293d9318394 /apps/files_sharing/api | |
parent | 460bafea8a636beb450c939f0bfe57dc0229a8c2 (diff) | |
download | nextcloud-server-00f48ec37ba90254aca4643b2627bb2ffc7bd1fb.tar.gz nextcloud-server-00f48ec37ba90254aca4643b2627bb2ffc7bd1fb.zip |
When the Share API is disabled do not return shares
Fixes #22668
Block everything in the OCS Share API
Diffstat (limited to 'apps/files_sharing/api')
-rw-r--r-- | apps/files_sharing/api/share20ocs.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php index 5a2af48d6f5..efdd9ecb30e 100644 --- a/apps/files_sharing/api/share20ocs.php +++ b/apps/files_sharing/api/share20ocs.php @@ -161,6 +161,10 @@ class Share20OCS { * @return \OC_OCS_Result */ public function getShare($id) { + if (!$this->shareManager->shareApiEnabled()) { + return new \OC_OCS_Result(null, 404, 'Share API is disabled'); + } + try { $share = $this->getShareById($id); } catch (ShareNotFound $e) { @@ -186,7 +190,10 @@ class Share20OCS { * @return \OC_OCS_Result */ public function deleteShare($id) { - // Try both our default and our federated provider + if (!$this->shareManager->shareApiEnabled()) { + return new \OC_OCS_Result(null, 404, 'Share API is disabled'); + } + try { $share = $this->getShareById($id); } catch (ShareNotFound $e) { @@ -208,6 +215,10 @@ class Share20OCS { public function createShare() { $share = $this->shareManager->newShare(); + if (!$this->shareManager->shareApiEnabled()) { + return new \OC_OCS_Result(null, 404, 'Share API is disabled'); + } + // Verify path $path = $this->request->getParam('path', null); if ($path === null) { @@ -421,6 +432,10 @@ class Share20OCS { * @return \OC_OCS_Result */ public function getShares() { + if (!$this->shareManager->shareApiEnabled()) { + return new \OC_OCS_Result(); + } + $sharedWithMe = $this->request->getParam('shared_with_me', null); $reshares = $this->request->getParam('reshares', null); $subfiles = $this->request->getParam('subfiles'); @@ -478,6 +493,10 @@ class Share20OCS { * @return \OC_OCS_Result */ public function updateShare($id) { + if (!$this->shareManager->shareApiEnabled()) { + return new \OC_OCS_Result(null, 404, 'Share API is disabled'); + } + try { $share = $this->getShareById($id); } catch (ShareNotFound $e) { |