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 c6536a6d01..7447814dd0 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'; } @@ -305,17 +305,6 @@ class Sharing // --> we dont need session and close it, to not modifiy it elseif ($keep_session === false) { - if ($GLOBALS['egw']->sharing->use_collabora()) - { - // check if sharee has Collabora run rights --> give is to share too - // we need to have collabora app to avoid CSP error since redirect share-link - // in collabora should get frame-src. e.g:(Collabora/Src/Ui.php:redirect(Sharing::share2link)) - $apps = $GLOBALS['egw']->acl->get_user_applications($share['share_owner']); - if (!empty($apps['collabora'])) - { - $GLOBALS['egw_info']['user']['apps']['collabora'] = $GLOBALS['egw_info']['apps']['collabora']; - } - } $GLOBALS['egw']->session->commit_session(); } // need to store new fstab and vfs_user in session to allow GET requests / downloads via WebDAV @@ -350,19 +339,6 @@ class Sharing !file_exists(__DIR__.'/../../../filemanager/inc/class.filemanager_ui.inc.php')); } - /** - * Check if we should use Collabora UI - * - * Only for files, if URL says so, and Collabora & Stylite apps are installed - */ - public function use_collabora() - { - return !Vfs::is_dir($this->share['share_root']) && - array_key_exists('edit', $_REQUEST) && - array_key_exists('collabora', $GLOBALS['egw_info']['apps']) && - array_key_exists('stylite', $GLOBALS['egw_info']['apps']); - } - /** * Server a request on a share specified in REQUEST_URI */ @@ -384,13 +360,8 @@ class Sharing $this->share['share_path'] => 1 )); } - if($this->use_collabora()) - { - $ui = new \EGroupware\Collabora\Ui(); - return $ui->editor($this->share['share_path']); - } // use pure WebDAV for everything but GET requests to directories - else if (!$this->use_filemanager()) + if (!$this->use_filemanager()) { // send a content-disposition header, so browser knows how to name downloaded file if (!Vfs::is_dir($this->share['share_root'])) @@ -460,8 +431,15 @@ class Sharing } else { - $vfs_path = static::resolve_path($path); - $exists = !!($vfs_path); + if(parse_url($path, PHP_URL_SCHEME) !== 'vfs') + { + $path = 'vfs://default'.($path[0] == '/' ? '' : '/').$path; + } + + if (($exists = ($stat = Vfs::stat($path)) && Vfs::check_access($path, Vfs::READABLE, $stat))) + { + $vfs_path = Vfs::parse_url($stat['url'], PHP_URL_PATH); + } } // check if file exists and is readable if (!$exists) @@ -566,36 +544,6 @@ class Sharing return $share; } - /** - * Get the actual VFS path for the given path - * - * We follow links & resolve whatever is possible so that when the share is - * mounted later (possibly by anonymous) the file can be found. - * - * @param string $path - * @return string - */ - public static function resolve_path($path) - { - $vfs_path = $path; - if(parse_url($path, PHP_URL_SCHEME) !== 'vfs') - { - $path = 'vfs://default'.($path[0] == '/' ? '' : '/').$path; - } - if (($exists = ($stat = Vfs::stat($path)) && Vfs::check_access($path, Vfs::READABLE, $stat))) - { - if (!preg_match("/^(sqlfs|vfs|stylite\.versioning|stylite\.merge)/", $stat['url'])) - { - $vfs_path = Vfs::parse_url($path, PHP_URL_PATH); - } - else - { - $vfs_path = Vfs::parse_url($stat['url'], PHP_URL_PATH); - } - } - return $vfs_path; - } - /** * Api\Storage\Base instance for egw_sharing table * 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'] !== '')