diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-12-05 15:39:31 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-12-16 11:01:02 -0100 |
commit | 3513833ccdde73f85d038025e5bfdf0a1f57810f (patch) | |
tree | 5c8c76e06b818cacab545dc18c89a5dd3fa57399 /apps/federatedfilesharing/lib | |
parent | faf58e4cacf6475110e32c7e5c8f37971b641b1a (diff) | |
download | nextcloud-server-3513833ccdde73f85d038025e5bfdf0a1f57810f.tar.gz nextcloud-server-3513833ccdde73f85d038025e5bfdf0a1f57810f.zip |
confirm auth on share generated by Circles
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
returns true
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
DI
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
DI
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'apps/federatedfilesharing/lib')
3 files changed, 19 insertions, 1 deletions
diff --git a/apps/federatedfilesharing/lib/AppInfo/Application.php b/apps/federatedfilesharing/lib/AppInfo/Application.php index b86ebebe26f..9a8892bb6f9 100644 --- a/apps/federatedfilesharing/lib/AppInfo/Application.php +++ b/apps/federatedfilesharing/lib/AppInfo/Application.php @@ -59,6 +59,7 @@ class Application extends App { $server->query(AddressHandler::class), $server->getLogger(), $server->getUserManager(), + $server->getShareManager(), $server->getCloudIdManager(), $server->getActivityManager(), $server->getNotificationManager(), diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 33f9f2899e5..bd5aea37047 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -98,7 +98,7 @@ class FederatedShareProvider implements IShareProvider { private $cloudFederationProviderManager; /** @var array list of supported share types */ - private $supportedShareType = [\OCP\Share::SHARE_TYPE_REMOTE_GROUP, \OCP\Share::SHARE_TYPE_REMOTE]; + private $supportedShareType = [IShare::TYPE_REMOTE_GROUP, IShare::TYPE_REMOTE, IShare::TYPE_CIRCLE]; /** * DefaultShareProvider constructor. diff --git a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php index 6ca0282d81f..c51c5d43589 100644 --- a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php +++ b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php @@ -50,6 +50,7 @@ use OCP\IUserManager; use OCP\Notification\IManager as INotificationManager; use OCP\Share; use OCP\Share\Exceptions\ShareNotFound; +use OCP\Share\IManager; use OCP\Share\IShare; use OCP\Util; @@ -70,6 +71,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { /** @var IUserManager */ private $userManager; + /** @var IManager */ + private $shareManager; + /** @var ICloudIdManager */ private $cloudIdManager; @@ -102,6 +106,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { * @param AddressHandler $addressHandler * @param ILogger $logger * @param IUserManager $userManager + * @param IManager $shareManager * @param ICloudIdManager $cloudIdManager * @param IActivityManager $activityManager * @param INotificationManager $notificationManager @@ -116,6 +121,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { AddressHandler $addressHandler, ILogger $logger, IUserManager $userManager, + IManager $shareManager, ICloudIdManager $cloudIdManager, IActivityManager $activityManager, INotificationManager $notificationManager, @@ -130,6 +136,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { $this->addressHandler = $addressHandler; $this->logger = $logger; $this->userManager = $userManager; + $this->shareManager = $shareManager; $this->cloudIdManager = $cloudIdManager; $this->activityManager = $activityManager; $this->notificationManager = $notificationManager; @@ -805,6 +812,16 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { return true; } + if ($share->getShareType() === IShare::TYPE_CIRCLE) { + try { + $knownShare = $this->shareManager->getShareByToken($token); + if ($knownShare->getId() === $share->getId()) { + return true; + } + } catch (ShareNotFound $e) { + } + } + throw new AuthenticationFailedException(); } |