]> source.dussan.org Git - nextcloud-server.git/commitdiff
Get proper accesslist for userFolder 4398/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Wed, 19 Apr 2017 13:11:54 +0000 (15:11 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Thu, 20 Apr 2017 08:28:32 +0000 (10:28 +0200)
If the accesslist is requested for a users root folder we should
properly construct the path

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
lib/private/Share20/Manager.php
tests/lib/Share20/ManagerTest.php

index 6e59629153e1c8d5338126a43bd1794069db1aee..3afd38c579f0273d90b9c01f070b7127b58e391a 100644 (file)
@@ -1233,7 +1233,7 @@ class Manager implements IManager {
 
                //Get node for the owner
                $userFolder = $this->rootFolder->getUserFolder($owner);
-               if (!$userFolder->isSubNode($path)) {
+               if ($path->getId() !== $userFolder->getId() && !$userFolder->isSubNode($path)) {
                        $path = $userFolder->getById($path->getId())[0];
                }
 
@@ -1245,7 +1245,12 @@ class Manager implements IManager {
 
                if ($currentAccess) {
                        $ownerPath = $path->getPath();
-                       list(, , , $ownerPath) = explode('/', $ownerPath, 4);
+                       $ownerPath = explode('/', $ownerPath, 4);
+                       if (count($ownerPath) < 4) {
+                               $ownerPath = '';
+                       } else {
+                               $ownerPath = $ownerPath[3];
+                       }
                        $al['users'][$owner] = [
                                'node_id' => $path->getId(),
                                'node_path' => '/' . $ownerPath,
index 42308a9d6a6b6a7be81ac38a92145059dce18153..7de73421d3e10e5a5d29f007fa7d6e99faa74f18 100644 (file)
@@ -2767,8 +2767,7 @@ class ManagerTest extends \Test\TestCase {
                $node->expects($this->once())
                        ->method('getOwner')
                        ->willReturn($owner);
-               $node->expects($this->once())
-                       ->method('getId')
+               $node->method('getId')
                        ->willReturn(42);
 
                $userFolder = $this->createMock(Folder::class);