lemonldap-ng/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBSlave.pm

33 lines
798 B
Perl
Raw Normal View History

2010-12-08 07:04:57 +01:00
## @file
# Slave userDB mechanism
## @class
# Slave userDB mechanism class
package Lemonldap::NG::Portal::UserDBSlave;
use strict;
use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::UserDBNull;
our $VERSION = '1.0.0';
our @ISA = qw(Lemonldap::NG::Portal::UserDBNull);
## @apmethod int setSessionInfo()
# Search exportedVars values in HTTP headers.
# @return Lemonldap::NG::Portal constant
sub setSessionInfo {
my $self = shift;
2010-12-08 11:42:53 +01:00
my $c = 0;
2010-12-08 07:04:57 +01:00
while ( my ( $k, $v ) = each %{ $self->{exportedVars} } ) {
$v = 'HTTP_' . uc($v);
$v =~ s/\-/_/g;
$self->{sessionInfo}->{$k} = $ENV{$v} and $c++;
}
2010-12-08 11:42:53 +01:00
$self->{sessionInfo}->{'_user'} ||=
$self->{sessionInfo}->{ $self->{slaveUserAttr} };
2010-12-08 07:04:57 +01:00
return ( $c ? PE_OK : PE_USERNOTFOUND );
}
1;