diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-18 13:38:38 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2016-02-19 12:43:03 +0100 |
commit | 2dcf887cceca8dd25b3d664fb0726cb6d69739ef (patch) | |
tree | 7b75669b305fb8331b9674b9bfc6d818a92566c6 /lib | |
parent | ae2304f23f04f1d6c84f2a049a4b0fdc0c9023c6 (diff) | |
download | nextcloud-server-2dcf887cceca8dd25b3d664fb0726cb6d69739ef.tar.gz nextcloud-server-2dcf887cceca8dd25b3d664fb0726cb6d69739ef.zip |
When (re-)sharing an incomming federated share set the corrent owner
Incomming federated shares are a special kind. We mount them as normal
webdav shares but we do supply owner info with the federated cloud id of
the share owner.
Since we do not yet have the new resharing behaviour on federated shares
we need to set the correct owner. Which will allow sharing and proper
mounting for other users.
fixes #22500
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/share20/manager.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index 4cff3dc818b..9b33e947557 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -517,8 +517,20 @@ class Manager implements IManager { // Verify if there are any issues with the path $this->pathCreateChecks($share->getNode()); - // On creation of a share the owner is always the owner of the path - $share->setShareOwner($share->getNode()->getOwner()->getUID()); + /* + * On creation of a share the owner is always the owner of the path + * Except for mounted federated shares. + */ + $storage = $share->getNode()->getStorage(); + if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { + $parent = $share->getNode()->getParent(); + while($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { + $parent = $parent->getParent(); + } + $share->setShareOwner($parent->getOwner()->getUID()); + } else { + $share->setShareOwner($share->getNode()->getOwner()->getUID()); + } // Cannot share with the owner if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && |