]> source.dussan.org Git - nextcloud-server.git/commitdiff
verify that circles is installed
authorMaxence Lange <maxence@nextcloud.com>
Tue, 20 Jun 2017 11:50:52 +0000 (10:50 -0100)
committerMorris Jobke <hey@morrisjobke.de>
Tue, 11 Jul 2017 18:21:06 +0000 (20:21 +0200)
Signed-off-by: Maxence Lange <maxence@nextcloud.com>
apps/files_sharing/lib/Controller/ShareAPIController.php
apps/files_sharing/lib/Controller/ShareesAPIController.php
lib/private/Share20/ProviderFactory.php

index bd57d80dab0f93d045411eca7b79c58a99c881bd..d0651edf89ab1f0f661e305eedc97b5df180ce99 100644 (file)
@@ -450,7 +450,7 @@ class ShareAPIController extends OCSController {
                        }
                        $share->setSharedWith($shareWith);
                } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) {
-                       if (!\OCP\App::isEnabled('circles')) {
+                       if (!\OCP\App::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'));
                        }
 
index 57d51ebac6a01cc902219ee16f2c760880050abf..1b9dffaa2c6a5606de7aba41ad66122a88c005f1 100644 (file)
@@ -472,7 +472,7 @@ class ShareesAPIController extends OCSController {
                        $shareTypes[] = Share::SHARE_TYPE_EMAIL;
                }
 
-               if (\OCP\App::isEnabled('circles')) {
+               if (\OCP\App::isEnabledForUser('circles') && class_exists('\OCA\Circles\ShareByCircleProvider')) {
                        $shareTypes[] = Share::SHARE_TYPE_CIRCLE;
                }
 
index ddd8177250bc7bd101e39f38307c0eafe2cc4b53..aedad6a32a75b8ca302c1b81f5c15e5081192524 100644 (file)
@@ -51,9 +51,10 @@ class ProviderFactory implements IProviderFactory {
        private $federatedProvider = null;
        /** @var  ShareByMailProvider */
        private $shareByMailProvider;
-       /** @var  \OCA\Circles\ShareByCircleProvider;
-        * ShareByCircleProvider */
-       private $shareByCircleProvider;
+       /** @var  \OCA\Circles\ShareByCircleProvider */
+       private $shareByCircleProvider = null;
+       /** @var bool */
+       private $circlesAreNotAvailable = false;
 
        /**
         * IProviderFactory constructor.
@@ -179,11 +180,16 @@ class ProviderFactory implements IProviderFactory {
         */
        protected function getShareByCircleProvider() {
 
-               $appManager = $this->serverContainer->getAppManager();
-               if (!$appManager->isEnabledForUser('circles')) {
+               if ($this->circlesAreNotAvailable) {
                        return null;
                }
 
+               if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
+                       !class_exists('\OCA\Circles\ShareByCircleProvider')
+               ) {
+                       $this->circlesAreNotAvailable = true;
+                       return null;
+               }
 
                if ($this->shareByCircleProvider === null) {