{
# Local access to bay directories. Note that in this context, we can
# ignore the public access rules associated with each bay, since this
# section of the config file applies only to local logins. We can also
# ignore the usepassword rules, since anonymous login is handled
# below.

    use esmith::AccountsDB;

    $OUT = "";

    my $adb = esmith::AccountsDB->open_ro();
    foreach my $ibay ($adb->ibays)
    {
	my %properties = $ibay->props;
	my $key = $ibay->key;
	my $umask = "027";

	if ($properties{'UserAccess'} eq 'wr-admin-rd-group')
	{
	    $umask = "027";
	}
	elsif ($properties{'UserAccess'} eq 'wr-group-rd-group')
	{
	    $umask = "007";
	}
	elsif ($properties{'UserAccess'} eq 'wr-group-rd-everyone')
	{
	    $umask = "002";
	}

	$OUT .= "\n";
	$OUT .= "<Directory /home/e-smith/files/ibays/$key/*>\n";
	$OUT .= "    AllowOverwrite on\n";
	$OUT .= "    GroupOwner shared\n";
	$OUT .= "    Umask $umask\n";
	$OUT .= "    <Limit WRITE>\n";
	$OUT .= "        AllowAll\n";
	$OUT .= "    </Limit>\n";
	$OUT .= "</Directory>\n";
    }
}
