Apache-SiteControl

 view release on metacpan or  search on metacpan

lib/Apache/SiteControl/User.pm  view on Meta::CPAN


# user object, apache request
sub logout
{
   my $this = shift;
   my $r = shift;

   if(!defined($this) || !defined($r)) {
      croak "INVALID CALL TO LOGOUT. You forgot to use OO syntax, or you forgot to pass the request object.";
   }
   eval("$this->{manager}" . '->invalidate($r, $this)');
   if($@) {
      $r->log_error("Logout failed: $@");
   }
}

1;

__END__

=head1 NAME

lib/Apache/SiteControl/UserFactory.pm  view on Meta::CPAN

      # This method should fail for new logins (or login after logout), so
      # failing to find the user is not considered a "real" error
      $r->log_error("Failed to find a user with cookie $ses_key.") if $debug;
      return undef;
   }

   return $user;
}

# Apache request, user object (not name)
sub invalidate
{
   my $this = shift;
   my $r = shift;
   my $userobj = shift;
   my $debug = $r->dir_config("SiteControlDebug") || 0;
   my $sessiondir = $r->dir_config("SiteControlSessions") || "/tmp";
   my $lockdir = $r->dir_config("SiteControlLocks") || "/tmp";
   my %session;

   if(!$userobj->isa("Apache::SiteControl::User") || !defined($userobj->{sessionid})) {

lib/Apache/SiteControl/UserFactory.pm  view on Meta::CPAN


=over 3

=item makeUser($$) 

This method is called with the Apache Request object, username, password, and
all other credential_# fields from the login form.  It must create and return
an instance of Apache::SiteControl::User (using new...See User), and store that
information (along with the session key stored in cookie format in the request)
in some sort of permanent storage.  This method is called in response to a
login, so it should invalidate any existing session for the given user name (so
that a user can be logged in only once).  This method must return the key to
use as the browser session key, or undef if it could not create the user.

=item findUser($$) 

This method is passed the apache request and the session key (which you defined
in makeUser).  This method is called every time a "logged in" user makes a
request. In other words the user objects are not persistent in memory (each
request gets a new "copy" of the state). This method uses the session key
(which was stored in a browser cookie) to figure out what user to restore. The
implementation is required to look up the user by the session key, recreate a
Apache::SiteControl::User object and return it. It must restore all user
attributes that have been saved via saveAttribute (below). 

=item invalidate($$) 

This method is passed the apache request object and a previously created user
object. It should delete the user object from permanent store so that future
request to find that user fails unless makeUser has been called to recreate it.
The session ID (which you made up in makeUser) is available from
$user->{sessionid}.

=item saveAttribute($$$)  

This method is automatically called whenever a user has a new attribute value.



( run in 0.894 second using v1.01-cache-2.11-cpan-a5abf4f5562 )