Polished off ACL support

This commit is contained in:
zone 2001-06-25 08:37:55 +00:00
parent 345eb7d14b
commit 5901222b03

View File

@ -108,6 +108,14 @@ if ($phpwh_debug)
$memberships = $phpgw->accounts->memberships ($userinfo["username"]); $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 # 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, # 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) if (!$group_ok)
{ {
echo $phpgw->common->error_list (array ("You do not have access to group/directory $matches[1]")); 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 (); html_page_close ();
} }
$group_applications = CreateObject('phpgwapi.applications', $phpgw->accounts->name2id ($matches[1])); if (!$membership_applications[$matches[1]][$appname]["enabled"])
$app_array = $group_applications->read_account_specific ();
if (!$app_array[$appname]["enabled"])
{ {
echo $phpgw->common->error_list (array ("The group $matches[1] does not have access to $appname")); echo $phpgw->common->error_list (array ("The group $matches[1] does not have access to $appname"));
html_break (2); html_break (2);
@ -208,6 +215,15 @@ if ($path == $fakebase)
reset ($memberships); reset ($memberships);
while (list ($num, $group_array) = each ($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))) if (!$phpgw->vfs->file_exists ("$fakebase/$group_array[account_name]", array (RELATIVE_NONE)))
{ {
$phpgw->vfs->mkdir ("$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); reset ($memberships);
while (list ($num, $group_array) = each ($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"]); $dirs[] = array ("directory" => $fakebase, "name" => $group_array["account_name"]);
$ls_array = $phpgw->vfs->ls ("$fakebase/$group_array[account_name]", array (RELATIVE_NONE), True, "Directory"); $ls_array = $phpgw->vfs->ls ("$fakebase/$group_array[account_name]", array (RELATIVE_NONE), True, "Directory");