summaryrefslogtreecommitdiffstats
path: root/lib/private/share20
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-02-25 20:22:35 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-02-25 20:40:30 +0100
commit8213d5df4f40410f851da31082bbb1fb8d84dd1e (patch)
tree5cb4c2bf7612ca317abc02b73512170624a5b2e6 /lib/private/share20
parent3772a8acdb611b441bf2ea4fa3e0a37110a9d69f (diff)
downloadnextcloud-server-8213d5df4f40410f851da31082bbb1fb8d84dd1e.tar.gz
nextcloud-server-8213d5df4f40410f851da31082bbb1fb8d84dd1e.zip
Do not allow sharing of the root folder
Sharing of the users root folder should not be allowed as it is very weird UX. Also many of our clients have no proper way of displaying this. Added unit test Also added intergration tests to make sure we won't allow it in the future.
Diffstat (limited to 'lib/private/share20')
-rw-r--r--lib/private/share20/manager.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php
index 9b33e947557..9fe33757473 100644
--- a/lib/private/share20/manager.php
+++ b/lib/private/share20/manager.php
@@ -197,6 +197,11 @@ class Manager implements IManager {
throw new \InvalidArgumentException('Path should be either a file or a folder');
}
+ // And you can't share your rootfolder
+ if ($this->rootFolder->getUserFolder($share->getSharedBy())->isSubNode($share->getNode()) === false) {
+ throw new \InvalidArgumentException('You can\'t share your root folder');
+ }
+
// Check if we actually have share permissions
if (!$share->getNode()->isShareable()) {
$message_t = $this->l->t('You are not allowed to share %s', [$share->getNode()->getPath()]);