summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-07-05 10:58:00 +0200
committerVincent Petry <pvince81@owncloud.com>2016-07-05 10:59:27 +0200
commita2bbc220e0d920084d79d004d043d20b24c454d2 (patch)
tree3c364aaa457a5067781af1b98fc177712563868a /lib
parentfdb0d4ad528425b934d9b039c9f09c132b86d0f4 (diff)
downloadnextcloud-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.php36
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()) {