From d426394685e91c0a2c49ed24e7cb45e61378b43b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 20 Mar 2018 11:54:33 +0100 Subject: [PATCH] correctly propagate readonly for sharing and Collabora --- api/src/Vfs.php | 5 +++++ api/src/Vfs/Sharing.php | 2 +- filemanager/inc/class.filemanager_shares.inc.php | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/src/Vfs.php b/api/src/Vfs.php index c13dbce8c9..791d986fcd 100644 --- a/api/src/Vfs.php +++ b/api/src/Vfs.php @@ -912,6 +912,11 @@ class Vfs return true; } } + // if we check writable and have a readonly mount --> return false, as backends dont know about r/o url parameter + if ($check == self::WRITABLE && Vfs\StreamWrapper::url_is_readonly($stat['url'])) + { + return false; + } // check backend for extended acls (only if path given) $ret = $path && self::_call_on_backend('check_extended_acl',array(isset($stat['url'])?$stat['url']:$path,$check),true); // true = fail silent if backend does not support diff --git a/api/src/Vfs/Sharing.php b/api/src/Vfs/Sharing.php index b7d3625e52..834d015eef 100644 --- a/api/src/Vfs/Sharing.php +++ b/api/src/Vfs/Sharing.php @@ -214,7 +214,7 @@ class Sharing } $share['resolve_url'] = Vfs::resolve_url($share['share_path'], true, true, true, true); // true = fix evtl. contained url parameter // if share not writable append ro=1 to mount url to make it readonly - if (!self::$db->from_bool($share['share_writable'])) + if (!($share['share_writable'] & 1)) { $share['resolve_url'] .= (strpos($share['resolve_url'], '?') ? '&' : '?').'ro=1'; } diff --git a/filemanager/inc/class.filemanager_shares.inc.php b/filemanager/inc/class.filemanager_shares.inc.php index 96e2b80dff..85314af5b3 100644 --- a/filemanager/inc/class.filemanager_shares.inc.php +++ b/filemanager/inc/class.filemanager_shares.inc.php @@ -79,7 +79,8 @@ class filemanager_shares extends filemanager_ui if (class_exists('EGroupware\\Collabora\\Wopi')) { - $query['col_filter'][] = 'share_writable != '.(int)EGroupware\Collabora\Wopi::WOPI_SHARE; + $query['col_filter'][] = 'share_writable NOT IN ('. + EGroupware\Collabora\Wopi::WOPI_WRITABLE.','.EGroupware\Collabora\Wopi::WOPI_READONLY.')'; } if ((string)$query['col_filter']['share_passwd'] !== '')