Koozali.org: home of the SME Server

Webcal

Simpleone

Webcal
« on: September 18, 2001, 10:09:36 AM »
Help if anyone can,

I have installed the Webcal and read the Howto doc but am having some trouble with the custom template section,,

 is there anyone that can help or email me the 90e-smithAccess40ibays file already modified ?

srose@cagz.com

P. Sanchez

Re: Webcal
« Reply #1 on: September 20, 2001, 05:27:49 AM »
#------------------------------------------------------------
# Information bay directories
#------------------------------------------------------------

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

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

    while (($key,$value) = each %accounts)
    {
   my ($type, %properties) = split (/\|/, $value, -1);
   if ($type eq 'ibay')
   {
       #------------------------------------------------------------
       # Figure out which combination of parameters to use. If
       # PublicAccess parameter is present, this is e-smith 4.0.
       # Otherwise, it's e-smith 3.0.
       #------------------------------------------------------------

            my $allow;
       my $pass;
       my $satisfy;
       
            if ($properties{'PublicAccess'})
       {
      if ($properties{'PublicAccess'} eq 'none')
      {
          next;
      }
      elsif ($properties{'PublicAccess'} eq 'local')
      {
          $allow   = $localAccess;
          $pass    = 0;
          $satisfy = 'all';
      }
      elsif ($properties{'PublicAccess'} eq 'local-pw')
      {
          $allow   = $localAccess;
          $pass    = 1;
          $satisfy = 'all';
      }
      elsif ($properties{'PublicAccess'} eq 'global')
      {
          $allow   = 'all';
          $pass    = 0;
          $satisfy = 'all';
      }
      elsif ($properties{'PublicAccess'} eq 'global-pw')
      {
          $allow   = 'all';
          $pass    = 1;
          $satisfy = 'all';
      }
      elsif ($properties{'PublicAccess'} eq 'global-pw-remote')
      {
          $allow   = $localAccess;
          $pass    = 1;
          $satisfy = 'any';
      }
       }
       elsif ($properties {'ReadAccess'} eq 'global')
       {
      if ($properties {'UsePassword'} eq 'yes')
      {
          $allow   = 'all';
          $pass    = 1;
          $satisfy = 'all';
      }
      else
      {
          $allow   = 'all';
          $pass    = 0;
          $satisfy = 'all';
      }
       }
       else
       {
      if ($properties {'UsePassword'} eq 'yes')
      {
          $allow   = $localAccess;
          $pass    = 1;
          $satisfy = 'all';
      }
      else
      {
          $allow   = $localAccess;
          $pass    = 0;
          $satisfy = 'all';
      }
       }


       my $dynamicContent = $properties{'CgiBin'} || "disabled";
            $result .= "\n";
            $result .= "#------------------------------------------------------------\n";
       $result .= "# $key ibay directories ($properties{'Name'})\n";
            $result .= "#------------------------------------------------------------\n";

            $result .= "\n";
            $result .= "\n";
            $result .= "    Options Indexes\n";
       if ($dynamicContent eq 'enabled')
       {
      $result .= "    Options +Includes\n";
       }
       else
       {
      $result .= "    \n";
      $result .= "        order deny,allow\n";
      $result .= "        Deny from all\n";
      $result .= "    
\n";
      $result .= "    Options +IncludesNOEXEC\n";
       }
            $result .= "    AllowOverride None\n";
            $result .= "    order deny,allow\n";
            $result .= "    deny from all\n";
            $result .= "    allow from $allow\n";
       if ($pass)
       {
                $result .= "    AuthName \"$properties{'Name'}\"\n";
                $result .= "    AuthType Basic\n";
                $result .= "    AuthExternal pwauth\n";
                $result .= "    require user $key\n";
      $result .= "    Satisfy $satisfy\n";
       }
            $result .= "
\n";

            $result .= "\n";
            $result .= "\n";
       if ($dynamicContent eq 'enabled')
       {
      $result .= "    Options ExecCGI\n";
       }
            $result .= "    AllowOverride None\n";
            $result .= "    order deny,allow\n";
            $result .= "    deny from all\n";
            $result .= "    allow from $allow\n";
       if ($pass)
       {
                $result .= "    AuthName \"$properties{'Name'}\"\n";
                $result .= "    AuthType Basic\n";
                $result .= "    AuthExternal pwauth\n";
                $result .= "    require user $key\n";
                $result .= "    Satisfy $satisfy\n";
       }
            $result .= "
\n";
            #this is just for webcal to allow admin access
            if ($key eq 'webcal')
            {
                $result .= "\n";
                $result .= "\n";
                $result .= "    Options ExecCGI\n";
                $result .= "    AllowOverride AuthConfig\n";
                $result .= "    order deny,allow\n";
                $result .= "    deny from all\n";
                $result .= "    allow from all\n";
                $result .= "
\n";
            }

            $result .= "\n";
            $result .= "\n";
            #this is for webcal only
            if ($key eq 'webcal')
            {
               $result .= "    AllowOverride AuthConfig\n";
            }
            else
            {
               $result .= "    AllowOverride None\n";    
            }
            $result .= "    ForceType application/octet-stream\n";
            $result .= "    order deny,allow\n";
            $result .= "    deny from all\n";
            $result .= "    allow from $allow\n";
       if ($pass)
       {
                $result .= "    AuthName \"$properties{'Name'}\"\n";
                $result .= "    AuthType Basic\n";
                $result .= "    AuthExternal pwauth\n";
                $result .= "    require user $key\n";
                $result .= "    Satisfy $satisfy\n";
       }
            $result .= "
\n";
   }
    }

    $result;
}