diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-07-05 10:58:00 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-07-05 10:59:27 +0200 |
commit | a2bbc220e0d920084d79d004d043d20b24c454d2 (patch) | |
tree | 3c364aaa457a5067781af1b98fc177712563868a /lib | |
parent | fdb0d4ad528425b934d9b039c9f09c132b86d0f4 (diff) | |
download | nextcloud-server-a2bbc220e0d920084d79d004d043d20b24c454d2.tar.gz nextcloud-server-a2bbc220e0d920084d79d004d043d20b24c454d2.zip |
Change order of share creation validation
Makes sure that the share owner is set before entering the checks that
need it.
Partial backport of afa37d3
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/share20/manager.php | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index 7a48de6a11c..b00f7ccd5b6 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -505,6 +505,24 @@ class Manager implements IManager { $this->generalCreateChecks($share); + // 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 + * 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()); + } + //Verify share type if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { $this->userCreateChecks($share); @@ -538,24 +556,6 @@ 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 - * 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 && $share->getSharedWith() === $share->getShareOwner()) { |