[ale] Apache scaling on virtual directories

Fletch fletch at phydeaux.org
Fri Sep 8 15:24:16 EDT 2000


>>>>> "Dan" == Dan Newcombe <Newcombe at mordor.clayton.edu> writes:

    Dan> On 8 Sep 2000, Fletch wrote:
    >> >>>>> "Dan" == Dan Newcombe <Newcombe at mordor.clayton.edu>
    >> writes: Use mod_perl to write an authen handler.  You'd set the
    >> handler up just on the top level archive directory and not on
    >> the individual directories.  The handler would then look at
    >> what subdir the request was for to determine if access would be
    >> allowed.

    Dan> But then a student enrolled in any class could get into any
    Dan> other classes list.

        No, not really.


package MyClassAuthz;

use strict;
use Apache::Constants qw(:common);

sub handler {
  my $handler = shift;
  return DECLINED unless $r->is_main;

  my $uri = $r->uri;

  return DECLINED unless $uri =~ m{^/class-lists/([^/]+)};

  my $user = $r->connection->user;
  my $class = $1;

  return AUTH_REQUIRED unless defined( $user );

  unless( valid_user( $user, $class ) ) {
    $r->note_basic_auth_failure;
    $r->log_reason( "User `$user' not enrolled in $class." );
    return AUTH_REQIRED 
  }

  return OK;
}

sub valid_user {
  my( $user, $class ) = @_;

  ###
  ### Magic contacting database to see if $user is registered for
  ### $class goes here, returning 1 if they are.  Consult perldoc DBI
  ### for more info.
  ###

  return 0;
}

1;

__END__

<Location /class-lists>
  AuthName "Class List Archives"
  AuthType Basic
  AuthDBMUserFile /www/conf/htpasswd.db

  PerlAuthzHandler MyClassAuthz;

  require valid-user
</Location>

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
678 443-6239(w)       |  scary questions." -- Jules                =(___)=
                      |                                               U
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.





More information about the Ale mailing list