summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/api
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-02-26 14:58:41 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-03-22 19:43:23 +0100
commit00f48ec37ba90254aca4643b2627bb2ffc7bd1fb (patch)
tree3ee7bbe37e47bdfb6b199e4b2f7ce293d9318394 /apps/files_sharing/api
parent460bafea8a636beb450c939f0bfe57dc0229a8c2 (diff)
downloadnextcloud-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.php21
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) {