[Mediawiki-l] UserLogin hook
Ingmar Heinrich
ingmar.heinrich at gmail.com
Fri Oct 13 08:37:11 UTC 2006
Hi there!
In the documentation I found an example for user login via LDAP:
--------8<--------8<--------8<--------8<--------8<--------8<---------
$wgHooks['UserLogin'][] = array('ldapLogin', $ldapServer);
$ldap['server']="ldaps://ldap.company.com/";
$ldap['port'] = 636;
$ldap['base'] = ",ou=Staff,dc=company,dc=com";
function ldapLogin($username, $password) {
global $ldap;
$auth_user="uid=".$username.$ldap['base'];
if($connect=@ldap_connect($ldap['server'],$ldap['port'])){
if($bind=@ldap_bind($connect, $auth_user, $password)){
@ldap_close($connect);
return(true);
}//if bound to ldap
else {
echo "Error on ldap_bind";
}
}//if connected to ldap
else {
echo "Error on ldap_connect";
}
@ldap_close($connect);
return(false);
}
--------8<--------8<--------8<--------8<--------8<--------8<---------
First of all, the example doesn't make sense to me because it calls
the function ldapLogin with one parameter, which is the LDAP server
name, but the function itself demands two parameters - login and
password. Secondly, I don't find the Hook UserLogin in the list of
available hooks.
What is this?
Cheers,
Inki
More information about the MediaWiki-l
mailing list