Added full configuration to LDAP (ie transferrable fields etc)
This commit is contained in:
@@ -2,39 +2,3 @@ LDAP-module README
|
||||
07.10.2002 Version 0.1, Petri Asikainen <[email protected]>
|
||||
|
||||
Ldap-authetication module is work in progress.
|
||||
Right now we are building config-interface to use also with all other auth-modules,
|
||||
but it will take sometime.
|
||||
|
||||
If you like to try ldap-authentication now , create following $CFG->variables to
|
||||
/moodle/config.php or directly to config-table and activate ldap authentication
|
||||
from admin-configuration page.
|
||||
|
||||
Variable Description
|
||||
$CFG->ldap_bind_dn "If your like to use bind-user to search
|
||||
users, specify it here. Something like
|
||||
'cn=ldapuser,ou=public,o=org'"
|
||||
$CFG->ldap_bind_pw "Password for bind-user."
|
||||
$CFG->ldap_contexts "List of contexts where users are located.
|
||||
Separate different contexts with ';'.
|
||||
Something like
|
||||
'ou=users,o=org; ou=other,o=org'"
|
||||
$CFG->ldap_host_url "Specify LDAP host in URL-form, like
|
||||
'ldap://ldap.myorg.com/' or
|
||||
'ldaps//ldap.myorg.com/' "
|
||||
$CFG->ldap_search_sub "Put value <> 0 if you like to
|
||||
search users from subcontexts.
|
||||
(Subsearching is sometimes slow)"
|
||||
$CFG->ldap_user_attribute "What attribute is used to name/search
|
||||
users. Usually 'cn' when using
|
||||
Novell e-directory
|
||||
$CFG->ldap_objectclass When filtering objects from ldap this filter is used
|
||||
defaults to "objectClass=*"
|
||||
|
||||
And if you like to _very_ experimental:
|
||||
Edit /auth/ldap/lib.php function auth_get_userinfo() attribute-mappings and
|
||||
set $CFG->auth_update_userinfo = 1
|
||||
Then moodle will get user first-, lastname and other information from ldap
|
||||
when user is login first time.
|
||||
|
||||
|
||||
|
||||
|
||||
+102
-8
@@ -1,4 +1,4 @@
|
||||
<tr valign="top">
|
||||
<tr valign="top" BGCOLOR="<?=$THEME->cellheading2 ?>">
|
||||
<TD ALIGN=RIGHT><P>ldap_host_url:</TD>
|
||||
<TD>
|
||||
<INPUT name=ldap_host_url TYPE=text SIZE=30 VALUE="<?=$config->ldap_host_url?>">
|
||||
@@ -9,8 +9,8 @@
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P>ldap_user_context(s):</TD>
|
||||
<TR VALIGN=TOP BGCOLOR="<?=$THEME->cellheading2 ?>">
|
||||
<TD ALIGN=RIGHT><P>ldap_user_context:</TD>
|
||||
<TD>
|
||||
<INPUT name=ldap_contexts TYPE=text SIZE=30 VALUE="<?=$config->ldap_contexts?>">
|
||||
<? formerr($err["ldap_contexts"]); ?>
|
||||
@@ -20,8 +20,8 @@
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P>ldap_user_attribute(s):</TD>
|
||||
<TR VALIGN=TOP BGCOLOR="<?=$THEME->cellheading2 ?>">
|
||||
<TD ALIGN=RIGHT><P>ldap_user_attribute:</TD>
|
||||
<TD>
|
||||
<INPUT name=ldap_user_attribute TYPE=text SIZE=30 VALUE="<?=$config->ldap_user_attribute?>">
|
||||
<? formerr($err["ldap_user_attribute"]); ?>
|
||||
@@ -31,7 +31,7 @@
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TR VALIGN=TOP BGCOLOR="<?=$THEME->cellheading2 ?>">
|
||||
<TD ALIGN=RIGHT><P>ldap_search_sub:</TD>
|
||||
<TD>
|
||||
<INPUT name=ldap_search_sub TYPE=text SIZE=1 VALUE="<?=$config->ldap_search_sub?>">
|
||||
@@ -42,7 +42,7 @@
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TR VALIGN=TOP BGCOLOR="<?=$THEME->cellheading2 ?>">
|
||||
<TD ALIGN=RIGHT><P>ldap_bind_dn:</TD>
|
||||
<TD>
|
||||
<INPUT name=ldap_bind_dn TYPE=text SIZE=30 VALUE="<?=$config->ldap_bind_dn?>">
|
||||
@@ -52,7 +52,7 @@
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TR VALIGN=TOP BGCOLOR="<?=$THEME->cellheading2 ?>">
|
||||
<TD ALIGN=RIGHT><P>ldap_bind_password:</TD>
|
||||
<TD>
|
||||
<INPUT name=ldap_bind_pw TYPE=text SIZE=30 VALUE="<?=$config->ldap_bind_pw?>">
|
||||
@@ -62,6 +62,96 @@
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
|
||||
|
||||
<TR>
|
||||
<TD ALIGN=RIGHT><P><? print_string("firstname") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_firstname" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_firstname?>">
|
||||
</TD>
|
||||
<TD rowspan=12 VALIGN=CENTER>
|
||||
<? print_string("auth_ldapextrafields","auth") ?>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("lastname") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_lastname" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_lastname?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("email") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_email" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_email?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("phone") ?> 1:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_phone1" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_phone1?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("phone") ?> 2:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_phone2" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_phone2?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("department") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_department" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_department?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("address") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_address" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_address?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("city") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_city" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_city?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("country") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_country" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_country?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("description") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_description" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_description?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("idnumber") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_idnumber" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_idnumber?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("language") ?>:</TD>
|
||||
<TD>
|
||||
<INPUT name="auth_user_lang" TYPE="text" SIZE="30" VALUE="<?=$config->auth_user_lang?>">
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><P><? print_string("instructions", "auth") ?>:</TD>
|
||||
<TD>
|
||||
@@ -72,3 +162,7 @@
|
||||
<? helpbutton("text", get_string("helptext")) ?>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+13
-15
@@ -42,25 +42,23 @@ function auth_get_userinfo($username){
|
||||
global $CFG;
|
||||
//reads userinformation from ldap and return it in array()
|
||||
|
||||
$result = array();
|
||||
$ldap_connection=auth_ldap_connect();
|
||||
|
||||
$config = (array)$CFG;
|
||||
$fields = array("firstname", "lastname", "email", "phone1", "phone2",
|
||||
"department", "address", "city", "country", "description",
|
||||
"idnumber", "lang");
|
||||
|
||||
$moodleattributes = array();
|
||||
//atribute mappings between moodle and ldap
|
||||
foreach ($fields as $field) {
|
||||
if ($config["auth_user_$field"]) {
|
||||
$moodleattributes[$field] = $config["auth_user_$field"];
|
||||
}
|
||||
}
|
||||
|
||||
$moodleattributes['firstname'] ='givenname';
|
||||
$moodleattributes['lastname'] ='sn';
|
||||
$moodleattributes['email'] ='mail';
|
||||
$moodleattributes['phone1'] ='telephonenumber';
|
||||
//$moodleattributes['phone2'] ='facsimiletelephonenumber';
|
||||
//$moodleattributes['institution'] ='institution';
|
||||
$moodleattributes['department'] ='ou';
|
||||
$moodleattributes['address'] ='street';
|
||||
$moodleattributes['city'] ='physicaldeliveryofficename';
|
||||
//$moodleattributes['country'] ='country';
|
||||
$moodleattributes['description'] ='description';
|
||||
$ldap_connection=auth_ldap_connect();
|
||||
|
||||
$result = array();
|
||||
$search_attribs = array();
|
||||
|
||||
foreach ($moodleattributes as $key=>$value) {
|
||||
array_push($search_attribs, $value);
|
||||
}
|
||||
|
||||
+8
-5
@@ -10,14 +10,16 @@
|
||||
<UL><DL>
|
||||
|
||||
<DT> Authentication
|
||||
<DD> Moodle now features seven different authentication mechanisms!
|
||||
<DD> Moodle now features seven different authentication mechanisms,
|
||||
making it possible to hook Moodle up to nearly any external list
|
||||
of users!
|
||||
New methods just added include IMAP, POP3 and NNTP servers (including
|
||||
those using SSL or certificate-based authentication), and also
|
||||
authentication against user-specified fields in ANY
|
||||
external database table. In addition, (thanks to contributor Petri
|
||||
Asikainen), Moodle now sports a cool new GUI for configuring
|
||||
all of this, so it should be pretty easy to hook Moodle up to
|
||||
nearly any external list of users.<BR><BR>
|
||||
external database table. In addition, Moodle now sports a cool
|
||||
new admin GUI for configuring all of this, so it should be pretty
|
||||
easy to configure all of this.
|
||||
Thanks to contributor Petri Asikainen for his work on the GUI.<BR><BR>
|
||||
|
||||
<DT> Languages
|
||||
<DD> Complete new Norwegian translation (see credits for details),
|
||||
@@ -35,6 +37,7 @@
|
||||
<LI> Timezones now range between -13 to 13 hours (for daylight saving).
|
||||
<LI> Character set in email now matches current language
|
||||
<LI> User pictures are now uploaded even if other fields have errors
|
||||
<LI> Submitted assignments were sometimes having their owner changed - fixed.
|
||||
</UL>
|
||||
|
||||
</DL></UL>
|
||||
|
||||
@@ -33,6 +33,7 @@ $string['auth_ldapdescription'] = "This method provides authentication against a
|
||||
entry in its database. This module can read user attributes from LDAP and prefill
|
||||
wanted fields in Moodle. For following logins only the username and
|
||||
password are checked.";
|
||||
$string['auth_ldapextrafields'] = "These fields are optional. You can choose to pre-fill some Moodle user fields with information from the <B>LDAP fields</B> that you specify here. <P>If you leave these fields blank, then nothing will be transferred from LDAP and Moodle defaults will be used instead.<P>In either case, the user will be able to edit all of these fields after they log in.";
|
||||
$string['auth_ldaptitle'] = "Use an LDAP server";
|
||||
$string['auth_nntpdescription'] = "This method uses an NNTP server to check whether a given username and password is valid.";
|
||||
$string['auth_nntphost'] = "The NNTP server address. Use the IP number, not DNS name.";
|
||||
|
||||
Reference in New Issue
Block a user