also remove mountpoints the user has no read access to from directory listings, eg. enabling versioning for an other user

This commit is contained in:
Ralf Becker 2010-06-14 13:18:41 +00:00
parent e5ac08edab
commit ef278963d7

View File

@ -922,20 +922,24 @@ class vfs_stream_wrapper implements iface_stream_wrapper
*/
function dir_readdir ( )
{
if ($this->extra_dirs && count($this->extra_dirs) > $this->extra_dir_ptr)
{
$file = $this->extra_dirs[$this->extra_dir_ptr++];
}
else
{
// only return children readable by the user, if dir is not writable
do {
$file = readdir($this->opened_dir);
// only return children readable by the user, if dir is not writable
do {
if ($this->extra_dirs && count($this->extra_dirs) > $this->extra_dir_ptr)
{
$file = $this->extra_dirs[$this->extra_dir_ptr++];
}
else
{
// do not return files in $this->extra_dir twice
do {
$file = readdir($this->opened_dir);
}
while($file !== false && (is_array($this->extra_dirs) && in_array($file,$this->extra_dirs))); // dont return mountpoints twice
}
while($file !== false && (is_array($this->extra_dirs) && in_array($file,$this->extra_dirs) || // dont return mountpoints twice
self::HIDE_UNREADABLES && !$this->opened_dir_writable &&
!egw_vfs::check_access(egw_vfs::concat($this->opened_dir_url,$file),egw_vfs::READABLE)));
}
while($file !== false && self::HIDE_UNREADABLES && !$this->opened_dir_writable &&
!egw_vfs::check_access(egw_vfs::concat($this->opened_dir_url,$file),egw_vfs::READABLE));
if (self::LOG_LEVEL > 1) error_log(__METHOD__."( $this->opened_dir ) = '$file'");
return $file;
}