summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/middleware/sharingcheckmiddleware.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/middleware/sharingcheckmiddleware.php')
-rw-r--r--apps/files_sharing/lib/middleware/sharingcheckmiddleware.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/middleware/sharingcheckmiddleware.php b/apps/files_sharing/lib/middleware/sharingcheckmiddleware.php
index 61dfd914d0b..f51399b76a8 100644
--- a/apps/files_sharing/lib/middleware/sharingcheckmiddleware.php
+++ b/apps/files_sharing/lib/middleware/sharingcheckmiddleware.php
@@ -68,6 +68,13 @@ class SharingCheckMiddleware extends Middleware {
if(!$this->isSharingEnabled()) {
throw new NotFoundException('Sharing is disabled.');
}
+
+ if ($controller instanceof \OCA\Files_Sharing\Controllers\ExternalSharesController) {
+ //TODO: Proper checks
+ } else if ($controller instanceof \OCA\Files_Sharing\Controllers\ShareController &&
+ !$this->isLinkSharingEnabled()) {
+ throw new NotFoundException('Link sharing is disabled');
+ }
}
/**
@@ -98,6 +105,14 @@ class SharingCheckMiddleware extends Middleware {
return false;
}
+ return true;
+ }
+
+ /**
+ * Check if link sharing is allowed
+ * @return bool
+ */
+ private function isLinkSharingEnabled() {
// Check if the shareAPI is enabled
if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
return false;