mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Allow config how aliases are derefered.
This commit is contained in:
parent
624dc86a4d
commit
8021cc54c1
2 changed files with 24 additions and 6 deletions
|
@ -5,6 +5,7 @@
|
|||
optional_variable($config->ldap_user_type, "");
|
||||
optional_variable($config->ldap_user_attribute, "");
|
||||
optional_variable($config->ldap_search_sub, "");
|
||||
optional_variable($config->ldap_opt_deref, "");
|
||||
optional_variable($config->ldap_bind_dn, "");
|
||||
optional_variable($config->ldap_bind_pw, "");
|
||||
optional_variable($config->ldap_version, "2");
|
||||
|
@ -163,6 +164,21 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
|||
<?php print_string("auth_ldap_search_sub","auth") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" bgcolor="<?php echo $THEME->cellheading2 ?>">
|
||||
<td align="right"><P>ldap_opt_deref:</td>
|
||||
<td>
|
||||
<?php
|
||||
$opt_deref[LDAP_DEREF_NEVER] = get_string("no");
|
||||
$opt_deref[LDAP_DEREF_ALWAYS] = get_string("yes");
|
||||
choose_from_menu($opt_deref, "ldap_opt_deref", $config->ldap_opt_deref, LDAP_DEREF_NEVER);
|
||||
if (isset($err["ldap_opt_deref"])) formerr($err["ldap_opt_deref"]);
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("auth_ldap_opt_deref","auth") ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" bgcolor="<?php echo $THEME->cellheading2 ?>">
|
||||
|
|
|
@ -1094,7 +1094,7 @@ function auth_ldap_connect($binddn='',$bindpwd=''){
|
|||
foreach ($urls as $server){
|
||||
$connresult = ldap_connect($server);
|
||||
//ldap_connect returns ALWAYS true
|
||||
|
||||
|
||||
if (!empty($CFG->ldap_version)) {
|
||||
ldap_set_option($connresult, LDAP_OPT_PROTOCOL_VERSION, $CFG->ldap_version);
|
||||
}
|
||||
|
@ -1105,8 +1105,12 @@ function auth_ldap_connect($binddn='',$bindpwd=''){
|
|||
} else {
|
||||
//bind anonymously
|
||||
$bindresult=@ldap_bind($connresult);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isset($CFG->ldap_opt_deref)) {
|
||||
ldap_set_option($connresult, LDAP_OPT_DEREF, $CFG->ldap_opt_deref);
|
||||
}
|
||||
|
||||
if ($bindresult) {
|
||||
return $connresult;
|
||||
}
|
||||
|
@ -1219,9 +1223,7 @@ function auth_ldap_get_userlist($filter="*") {
|
|||
|
||||
if ($CFG->ldap_search_sub) {
|
||||
//use ldap_search to find first user from subtree
|
||||
$ldap_result = ldap_search($ldapconnection, $context,
|
||||
$filter,
|
||||
array($CFG->ldap_user_attribute));
|
||||
$ldap_result = ldap_search($ldapconnection, $context,$filter,array($CFG->ldap_user_attribute));
|
||||
} else {
|
||||
//search only in this context
|
||||
$ldap_result = ldap_list($ldapconnection, $context,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue