From 4642a4ef07a8336a899ce2833dfc1c11af12383c Mon Sep 17 00:00:00 2001 From: "Aleksander Machniak (Kolab Systems)" Date: Fri, 29 Jul 2011 15:25:50 +0200 Subject: [PATCH] In folder selector show folders according to ACL (#216) --- plugins/kolab_core/rcube_kolab.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/kolab_core/rcube_kolab.php b/plugins/kolab_core/rcube_kolab.php index bf79b13a..63ff2dc0 100644 --- a/plugins/kolab_core/rcube_kolab.php +++ b/plugins/kolab_core/rcube_kolab.php @@ -431,6 +431,11 @@ class rcube_kolab $names = array(); $len = strlen($current); + if ($len && ($rpos = strrpos($current, $delim))) { + $parent = substr($current, 0, $rpos-1); + $p_len = strlen($parent); + } + // Filter folders list foreach ($folders as $c_folder) { $name = $c_folder->name; @@ -439,6 +444,16 @@ class rcube_kolab continue; } + // always show the parent of current folder + if ($p_len && $name == $parent) { } + // skip folders where user have no rights to create subfolders + else if ($c_folder->getOwner() != $_SESSION['username']) { + $rights = $c_folder->getMyRights(); + if (PEAR::IsError($rights) || !preg_match('/[ck]/', $rights)) { + continue; + } + } + $names[$name] = rcube_charset_convert($name, 'UTF7-IMAP'); }