{
    my %conf;
    tie %conf, 'esmith::config';

    my %accounts;
    tie %accounts, 'esmith::config', '/home/e-smith/db/accounts';

    my $key;
    my $value;
    my $result = "";

    # Global user dir assignments. Give ~user access
    # Turned on/off globally through the var UserPublicWeb
    # eg. to turn on  run /sbin/e-smith/config set UserPublicWeb on
    #     to turn off run /sbin/e-smith/config set UserPublicWeb off
    if(defined($conf{'UserPublicWeb'}) && ($conf{'UserPublicWeb'} eq "on"))
    {
        $result .= "#-------------------------------------------------------\n";
        $result .= "# Alias to enable /user aswell as /~user access\n";
        $result .= "#-------------------------------------------------------\n";
        while (($key,$value) = each %accounts)
        {
            my ($type, %properties) = split (/\|/, $value, -1);
            if ($type eq 'user')
       	    {
                $result .= "Alias /$key	/home/e-smith/files/users/$key/home/public_html\n";
            }
        }

        $result .= "\n";
        $result .= "#-------------------------------------------------------\n";
        $result .= "#Generic user dir access directive\n";
        $result .= "#-------------------------------------------------------\n";
        $result .= "<Directory /home/e-smith/files/users/*/home/public_html>\n";
        $result .= "    AllowOverride FileInfo AuthConfig Limit\n";
       	$result .= "    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec\n";
        $result .= "    <Limit GET POST OPTIONS PROPFIND>\n";
        $result .= "        Order allow,deny\n";
        $result .= "        Allow from all\n";
        $result .= "    </Limit>\n";
        $result .= "    <Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>\n";
        $result .= "        Order deny,allow\n";
        $result .= "        Deny from all\n";
        $result .= "    </Limit>\n";
        $result .= "</Directory>\n";
    }
    $result;
}

