summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-06-29 10:10:58 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-08-08 14:25:43 +0200
commit4ee839d69c83bcd71d194864eed47f4448a6ca85 (patch)
tree474197c459c9397f11646fa153c4adc21b2f35b9 /lib
parent857bb4536628814cdae3591c795bb1e21e9704b7 (diff)
downloadnextcloud-server-4ee839d69c83bcd71d194864eed47f4448a6ca85.tar.gz
nextcloud-server-4ee839d69c83bcd71d194864eed47f4448a6ca85.zip
Add provider for room shares
The RoomShareProvider is provided by the Talk app, so it is necessary to check whether the app is available or not, and also whether the class itself exists or not (just in case an older version of the app that did not have support yet for room shares is being used). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Share20/ProviderFactory.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php
index 0aacca409d1..6cb6c082df5 100644
--- a/lib/private/Share20/ProviderFactory.php
+++ b/lib/private/Share20/ProviderFactory.php
@@ -60,6 +60,8 @@ class ProviderFactory implements IProviderFactory {
private $shareByCircleProvider = null;
/** @var bool */
private $circlesAreNotAvailable = false;
+ /** @var \OCA\Spreed\Share\RoomShareProvider */
+ private $roomShareProvider = null;
/**
* IProviderFactory constructor.
@@ -221,6 +223,30 @@ class ProviderFactory implements IProviderFactory {
return $this->shareByCircleProvider;
}
+ /**
+ * Create the room share provider
+ *
+ * @return RoomShareProvider
+ */
+ protected function getRoomShareProvider() {
+ if ($this->roomShareProvider === null) {
+ /*
+ * Check if the app is enabled
+ */
+ $appManager = $this->serverContainer->getAppManager();
+ if (!$appManager->isEnabledForUser('spreed')) {
+ return null;
+ }
+
+ try {
+ $this->roomShareProvider = $this->serverContainer->query('\OCA\Spreed\Share\RoomShareProvider');
+ } catch (\OCP\AppFramework\QueryException $e) {
+ return null;
+ }
+ }
+
+ return $this->roomShareProvider;
+ }
/**
* @inheritdoc
@@ -235,6 +261,8 @@ class ProviderFactory implements IProviderFactory {
$provider = $this->getShareByMailProvider();
} else if ($id === 'ocCircleShare') {
$provider = $this->getShareByCircleProvider();
+ } else if ($id === 'ocRoomShare') {
+ $provider = $this->getRoomShareProvider();
}
if ($provider === null) {
@@ -261,6 +289,8 @@ class ProviderFactory implements IProviderFactory {
$provider = $this->getShareByMailProvider();
} else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) {
$provider = $this->getShareByCircleProvider();
+ } else if ($shareType === \OCP\Share::SHARE_TYPE_ROOM) {
+ $provider = $this->getRoomShareProvider();
}
@@ -281,6 +311,10 @@ class ProviderFactory implements IProviderFactory {
if ($shareByCircle !== null) {
$shares[] = $shareByCircle;
}
+ $roomShare = $this->getRoomShareProvider();
+ if ($roomShare !== null) {
+ $shares[] = $roomShare;
+ }
return $shares;
}