User login.pl

From EPrints Documentation
Revision as of 10:36, 6 August 2010 by Tdb01r (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Synopsis

$c->{check_user_password} = sub {
 my( $repo, $username, $password ) = @_;
 
 return $ok ? $username : undef;
};

LDAP Authentication

See LDAP.

User masquerading

Warning This feature requires EPrints version 3.2.4 or later

This tweak for check_user_password enables administrators to log into a system as any other user by using a special "/[username]" postfix to their normal username.

$c->{check_user_password} = sub {
 my( $repo, $u, $password ) = @_;

 my( $username, $alias ) = split /\//, $u;
 
 ... normal authentication for $username

 if( $alias && $user->get_type eq "admin" )
 {
   $user = $repo->user_by_username( $alias );
   $username = defined $user ? $user->value( "username" ) : undef;
 }

 return $username;
}