summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20/ProviderFactory.php
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2016-07-29 15:38:31 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2016-11-01 19:51:11 +0100
commita17c6a485d91bdc1c322a454c66d9d017a5f8ca5 (patch)
tree96b90220f17bfd7143b10051ab38c4f6e071d56d /lib/private/Share20/ProviderFactory.php
parent0a6f02801f333c17ca6455906bc816020883477d (diff)
downloadnextcloud-server-a17c6a485d91bdc1c322a454c66d9d017a5f8ca5.tar.gz
nextcloud-server-a17c6a485d91bdc1c322a454c66d9d017a5f8ca5.zip
add share by mail share provider
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib/private/Share20/ProviderFactory.php')
-rw-r--r--lib/private/Share20/ProviderFactory.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php
index 5cdc9a51a22..e1ed64d66ad 100644
--- a/lib/private/Share20/ProviderFactory.php
+++ b/lib/private/Share20/ProviderFactory.php
@@ -28,6 +28,7 @@ use OCA\FederatedFileSharing\DiscoveryManager;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\FederatedFileSharing\Notifications;
use OCA\FederatedFileSharing\TokenHandler;
+use OCA\ShareByMail\ShareByMailProvider;
use OCP\Share\IProviderFactory;
use OC\Share20\Exception\ProviderException;
use OCP\IServerContainer;
@@ -45,6 +46,8 @@ class ProviderFactory implements IProviderFactory {
private $defaultProvider = null;
/** @var FederatedShareProvider */
private $federatedProvider = null;
+ /** @var ShareByMailProvider */
+ private $shareByMailProvider;
/**
* IProviderFactory constructor.
@@ -126,6 +129,37 @@ class ProviderFactory implements IProviderFactory {
}
/**
+ * Create the federated share provider
+ *
+ * @return FederatedShareProvider
+ */
+ protected function getShareByMailProvider() {
+ if ($this->shareByMailProvider === null) {
+ /*
+ * Check if the app is enabled
+ */
+ $appManager = $this->serverContainer->getAppManager();
+ if (!$appManager->isEnabledForUser('sharebymail')) {
+ return null;
+ }
+
+ $l = $this->serverContainer->getL10N('sharebymail');
+
+ $this->shareByMailProvider = new ShareByMailProvider(
+ $this->serverContainer->getDatabaseConnection(),
+ $this->serverContainer->getSecureRandom(),
+ $this->serverContainer->getUserManager(),
+ $this->serverContainer->getLazyRootFolder(),
+ $l,
+ $this->serverContainer->getLogger()
+ );
+ }
+
+ return $this->shareByMailProvider;
+ }
+
+
+ /**
* @inheritdoc
*/
public function getProvider($id) {
@@ -134,6 +168,8 @@ class ProviderFactory implements IProviderFactory {
$provider = $this->defaultShareProvider();
} else if ($id === 'ocFederatedSharing') {
$provider = $this->federatedShareProvider();
+ } else if ($id = 'ocMailShare') {
+ $provider = $this->getShareByMailProvider();
}
if ($provider === null) {
@@ -155,6 +191,8 @@ class ProviderFactory implements IProviderFactory {
$provider = $this->defaultShareProvider();
} else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
$provider = $this->federatedShareProvider();
+ } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) {
+ $provider = $this->getShareByMailProvider();
}
if ($provider === null) {