summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@nextcloud.com>2017-07-11 13:21:24 +0200
committerMaxence Lange <maxence@nextcloud.com>2017-07-11 13:21:24 +0200
commit6e7be6acfdf998eff0b229626dc533572318df80 (patch)
treec3d4c42d22fbc96066340693bd1eecdd8692820e
parent23ff76975fb0c81aa8e27d6b9dbfe0ba1f263cd1 (diff)
downloadnextcloud-server-6e7be6acfdf998eff0b229626dc533572318df80.tar.gz
nextcloud-server-6e7be6acfdf998eff0b229626dc533572318df80.zip
upstream
Signed-off-by: Maxence Lange <maxence@nextcloud.com>
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php4
-rw-r--r--apps/files_sharing/lib/Controller/ShareesAPIController.php2
-rw-r--r--lib/private/Share20/Manager.php2
-rw-r--r--lib/private/Share20/ProviderFactory.php16
4 files changed, 15 insertions, 9 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index bd57d80dab0..458102036be 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -450,11 +450,11 @@ class ShareAPIController extends OCSController {
}
$share->setSharedWith($shareWith);
} else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) {
- if (!\OCP\App::isEnabled('circles')) {
+ if (!\OC::$server->getAppManager()->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'));
}
- $circle = \OCA\Circles\Api\Circles::detailsCircle($shareWith);
+ $circle = \OCA\Circles\Api\v1\Circles::detailsCircle($shareWith);
// Valid circle is required to share
if ($circle === null) {
diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php
index 57d51ebac6a..3e0c01b342e 100644
--- a/apps/files_sharing/lib/Controller/ShareesAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php
@@ -472,7 +472,7 @@ class ShareesAPIController extends OCSController {
$shareTypes[] = Share::SHARE_TYPE_EMAIL;
}
- if (\OCP\App::isEnabled('circles')) {
+ if (\OC::$server->getAppManager()->isEnabledForUser('circles') && class_exists('\OCA\Circles\ShareByCircleProvider')) {
$shareTypes[] = Share::SHARE_TYPE_CIRCLE;
}
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 7c39733ce2a..798ea937038 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -193,7 +193,7 @@ class Manager implements IManager {
throw new \InvalidArgumentException('SharedWith should not be empty');
}
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) {
- $circle = \OCA\Circles\Api\Circles::detailsCircle($share->getSharedWith());
+ $circle = \OCA\Circles\Api\v1\Circles::detailsCircle($share->getSharedWith());
if ($circle === null) {
throw new \InvalidArgumentException('SharedWith is not a valid circle');
}
diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php
index ddd8177250b..aedad6a32a7 100644
--- a/lib/private/Share20/ProviderFactory.php
+++ b/lib/private/Share20/ProviderFactory.php
@@ -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) {