From 631a0b11d621492bbf7d297df5813514194755e0 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 16 Sep 2020 08:42:01 +0200 Subject: [PATCH] some tests and fixes for proppatch/profind --- api/src/Vfs/Sqlfs/StreamWrapper.php | 2 +- vfs-context.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/src/Vfs/Sqlfs/StreamWrapper.php b/api/src/Vfs/Sqlfs/StreamWrapper.php index f4f1f2b69a..46a8614202 100644 --- a/api/src/Vfs/Sqlfs/StreamWrapper.php +++ b/api/src/Vfs/Sqlfs/StreamWrapper.php @@ -1864,7 +1864,7 @@ GROUP BY A.fs_id'; { return false; } - if (!Vfs::check_access($path,Api\Acl::EDIT,$stat)) + if (!Vfs::check_access($path,Api\Acl::EDIT, $stat, $this->user)) { return false; // permission denied } diff --git a/vfs-context.php b/vfs-context.php index b0ce8fe5db..3155ce0bf4 100644 --- a/vfs-context.php +++ b/vfs-context.php @@ -17,11 +17,15 @@ $GLOBALS['egw_info']['user'] = [ var_dump(Vfs\StreamWrapper::mount()); var_dump(file_put_contents('vfs://default/home/ralf/test.txt', "Just a test ;)\n")); +var_dump("Vfs::proppatch('/home/ralf/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])=".array2string(Vfs::proppatch('/home/ralf/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])), + "Vfs::propfind('/home/ralf/test.txt')=".json_encode(Vfs::propfind('/home/ralf/test.txt'), JSON_UNESCAPED_SLASHES)); var_dump($f=fopen('vfs://default/home/ralf/test.txt', 'r'), fread($f, 100), fclose($f)); Vfs::$is_root = true; var_dump(file_put_contents('vfs://default/home/birgit/test.txt', "Just a test ;)\n")); +var_dump("Vfs::proppatch('/home/birgit/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])=".array2string(Vfs::proppatch('/home/birgit/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])), + "Vfs::propfind('/home/birgit/test.txt')=".json_encode(Vfs::propfind('/home/birgit/test.txt'), JSON_UNESCAPED_SLASHES)); var_dump(Vfs\StreamWrapper::mount('vfs://birgit@default/home/birgit', '/home/ralf/birgit')); Vfs::$is_root = false; @@ -31,6 +35,9 @@ var_dump("Vfs::resolve_url('/home/ralf/birgit/test.txt')=".Vfs::resolve_url('/ho var_dump("Vfs::url_stat('/home/ralf/birgit/test.txt')=".json_encode(Vfs::stat('/home/ralf/birgit/test.txt'), JSON_UNESCAPED_SLASHES)); var_dump("Vfs::is_readable('/home/ralf/birgit/test.txt')=".json_encode(Vfs::is_readable('/home/ralf/birgit/test.txt'))); var_dump("fopen('vfs://default/home/ralf/birgit/test.txt', 'r')", $f=fopen('vfs://default/home/ralf/birgit/test.txt', 'r'), fread($f, 100), fclose($f)); +var_dump("Vfs::propfind('/home/ralf/birgit/test.txt')", Vfs::propfind('/home/ralf/birgit/test.txt')); +var_dump("Vfs::proppatch('/home/ralf/birgit/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something else']])=".array2string(Vfs::proppatch('/home/ralf/birgit/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something else']])), + "Vfs::propfind('/home/ralf/birgit/test.txt')=".json_encode(Vfs::propfind('/home/ralf/birgit/test.txt'), JSON_UNESCAPED_SLASHES)); var_dump("Vfs::url_stat('/home/ralf/birgit/test.txt')=".json_encode(Vfs::stat('/home/ralf/birgit/test-dir'))); var_dump("Vfs::mkdir('/home/ralf/birgit/test-dir')=".json_encode(Vfs::mkdir('/home/ralf/birgit/test-dir')));