diff --git a/filemanager/index.php b/filemanager/index.php index b2953619e5..3dfd4c6953 100755 --- a/filemanager/index.php +++ b/filemanager/index.php @@ -108,6 +108,14 @@ if ($phpwh_debug) $memberships = $phpgw->accounts->memberships ($userinfo["username"]); +while (list ($num, $group_array) = each ($memberships)) +{ + $membership_id = $phpgw->accounts->name2id ($group_array["account_name"]); + + $group_applications = CreateObject('phpgwapi.applications', $membership_id); + $membership_applications[$group_array["account_name"]] = $group_applications->read_account_specific (); +} + ### # We determine if they're in their home directory or a group's directory # If they request a group's directory, we ensure they have access to the group, @@ -130,13 +138,12 @@ if ((preg_match ("+^$fakebase\/(.*)(\/|$)+U", $path, $matches)) && $matches[1] ! if (!$group_ok) { echo $phpgw->common->error_list (array ("You do not have access to group/directory $matches[1]")); + html_break (2); + html_link ("$appname/index.php?path=$homedir", "Go to your home directory"); html_page_close (); } - $group_applications = CreateObject('phpgwapi.applications', $phpgw->accounts->name2id ($matches[1])); - - $app_array = $group_applications->read_account_specific (); - if (!$app_array[$appname]["enabled"]) + if (!$membership_applications[$matches[1]][$appname]["enabled"]) { echo $phpgw->common->error_list (array ("The group $matches[1] does not have access to $appname")); html_break (2); @@ -208,6 +215,15 @@ if ($path == $fakebase) reset ($memberships); while (list ($num, $group_array) = each ($memberships)) { + ### + # If the group doesn't have access to this app, we don't show it + ### + + if (!$membership_applications[$group_array["account_name"]][$appname]["enabled"]) + { + continue; + } + if (!$phpgw->vfs->file_exists ("$fakebase/$group_array[account_name]", array (RELATIVE_NONE))) { $phpgw->vfs->mkdir ("$fakebase/$group_array[account_name]", array (RELATIVE_NONE)); @@ -657,6 +673,15 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed reset ($memberships); while (list ($num, $group_array) = each ($memberships)) { + ### + # Don't list directories for groups that don't have access + ### + + if (!$membership_applications[$group_array["account_name"]][$appname]["enabled"]) + { + continue; + } + $dirs[] = array ("directory" => $fakebase, "name" => $group_array["account_name"]); $ls_array = $phpgw->vfs->ls ("$fakebase/$group_array[account_name]", array (RELATIVE_NONE), True, "Directory");