* @param IL10N $l
* @param IProviderFactory $factory
* @param IUserManager $userManager
+ * @param IRootFolder $rootFolder
*/
public function __construct(
ILogger $logger,
}
if ($share->getPermissions() !== $originalShare->getPermissions()) {
+ $userFolder = $this->rootFolder->getUserFolder($share->getShareOwner());
\OC_Hook::emit('OCP\Share', 'post_update_permissions', array(
'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(),
'shareWith' => $share->getSharedWith(),
'uidOwner' => $share->getSharedBy(),
'permissions' => $share->getPermissions(),
- 'path' => $share->getNode()->getPath(),
+ 'path' => $userFolder->getRelativePath($share->getNode()->getPath()),
));
}
$node = $this->getMock('\OCP\Files\File');
$node->method('getId')->willReturn(100);
- $node->method('getPath')->willReturn('myPath');
+ $node->method('getPath')->willReturn('/newUser/files/myPath');
$manager->expects($this->once())->method('canShare')->willReturn(true);
$manager->expects($this->once())->method('getShareById')->with('foo:42')->willReturn($originalShare);
\OCP\Util::connectHook('OCP\Share', 'post_set_expiration_date', $hookListner, 'post');
$hookListner->expects($this->never())->method('post');
+ $this->rootFolder->method('getUserFolder')->with('newUser')->will($this->returnSelf());
+ $this->rootFolder->method('getRelativePath')->with('/newUser/files/myPath')->willReturn('/myPath');
+
$hookListner2 = $this->getMockBuilder('Dummy')->setMethods(['post'])->getMock();
\OCP\Util::connectHook('OCP\Share', 'post_update_permissions', $hookListner2, 'post');
$hookListner2->expects($this->once())->method('post')->with([
'shareWith' => 'origUser',
'uidOwner' => 'sharer',
'permissions' => 31,
- 'path' => 'myPath',
+ 'path' => '/myPath',
]);
$manager->updateShare($share);