Apache-SiteControl
view release on metacpan or search on metacpan
lib/Apache/SiteControl.pm view on Meta::CPAN
$r->log_error("Loading module $factory") if $debug;
eval "require $factory" or $r->log_error("Could not load $factory: $@");
$factory = '$managers{$name}' . " = $factory" . '->getPermissionManager()';
$r->log_error("Building a manager using: $factory") if $debug;
eval($factory) or $r->log_error("Evaluation failed: $@");
return $managers{$name};
}
# This is the method that receives the login form data and decides if the
# user is allowed to log in.
sub authen_cred
{
my $this = shift; # Package name (same as AuthName directive)
my $r = shift; # Apache request object
my @cred = @_; # Credentials from login form
my $debug = $r->dir_config("SiteControlDebug") || 0;
my $checker = $r->dir_config("SiteControlMethod") || "Apache::SiteControl::Radius";
my $factory = $r->dir_config("SiteControlUserFactory") || "Apache::SiteControl::UserFactory";
my $user = undef;
lib/Apache/SiteControl/PermissionManager.pm view on Meta::CPAN
Apache::SiteControl::User or subclass thereof.
An action can be any data type (i.e. simply a string). Again, it is really up
to the code of the rules (which are primarily written by you) to determine what
is valid.
The overall usage of this package is as follows:
=over 8
=item B<1.> Decide how you want to represent a user. (i.e. Apache::SiteControl::User)
=item B<2.> Decide the critical sections of your code that need to be
protected, and decide what to do if the user doesn't pass muster. For example
if a screen should just hide fields, then the application code needs to reflect
that.
=item B<3.> Create a permission manager instance for your application.
Typically use a singleton pattern (there need be only one manager). In the
SiteControl system, this is done by a ManagerFactory that you write.
=item B<4.> Surround sensitive sections of code with something like:
if($manager->can($user, "view salary", $payrollRecord))
( run in 0.577 second using v1.01-cache-2.11-cpan-de7293f3b23 )