diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-08 14:52:15 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-08 14:52:15 +0200 |
commit | 53acb4a65fc72e2f383db4d978907e7ce219a4b2 (patch) | |
tree | 8c430028dd8c1f5226db2131b0f3b377c85ef0c6 /lib | |
parent | 6fb1008e1b1a7683c8fa168c45f5d8d47b3bda0f (diff) | |
parent | eda71240e2a158e2f282486fb7404512478dc19b (diff) | |
download | nextcloud-server-53acb4a65fc72e2f383db4d978907e7ce219a4b2.tar.gz nextcloud-server-53acb4a65fc72e2f383db4d978907e7ce219a4b2.zip |
Merge pull request #23736 from owncloud/move_public_webdav_auth_to_share_manager
Move public webdav auth to share manager
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Share20/Manager.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 6c665f7e133..be7257de36d 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -976,7 +976,17 @@ class Manager implements IManager { public function getShareByToken($token) { $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK); - $share = $provider->getShareByToken($token); + try { + $share = $provider->getShareByToken($token); + } catch (ShareNotFound $e) { + //Ignore + } + + // If it is not a link share try to fetch a federated share by token + if ($share === null) { + $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_REMOTE); + $share = $provider->getShareByToken($token); + } if ($share->getExpirationDate() !== null && $share->getExpirationDate() <= new \DateTime()) { @@ -984,6 +994,14 @@ class Manager implements IManager { throw new ShareNotFound(); } + /* + * Reduce the permissions for link shares if public upload is not enabled + */ + if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK && + !$this->shareApiLinkAllowPublicUpload()) { + $share->setPermissions($share->getPermissions() & ~(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE)); + } + return $share; } |