From: moodler Date: Thu, 21 Nov 2002 11:27:44 +0000 (+0000) Subject: Added full configuration to LDAP (ie transferrable fields etc) X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7c58aee6c7433b10661e8e85dcbe20e7f620dbc1;p=moodle.git Added full configuration to LDAP (ie transferrable fields etc) --- diff --git a/auth/ldap/README-LDAP b/auth/ldap/README-LDAP index 8cea11cd82..c51d452917 100644 --- a/auth/ldap/README-LDAP +++ b/auth/ldap/README-LDAP @@ -2,39 +2,3 @@ LDAP-module README 07.10.2002 Version 0.1, Petri Asikainen 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. - - - diff --git a/auth/ldap/config.html b/auth/ldap/config.html index 9ca38164f5..aff8268330 100644 --- a/auth/ldap/config.html +++ b/auth/ldap/config.html @@ -1,4 +1,4 @@ - +

ldap_host_url: @@ -9,8 +9,8 @@ - -

ldap_user_context(s): + +

ldap_user_context: @@ -20,8 +20,8 @@ - -

ldap_user_attribute(s): + +

ldap_user_attribute: @@ -31,7 +31,7 @@ - +

ldap_search_sub: @@ -42,7 +42,7 @@ - +

ldap_bind_dn: @@ -52,7 +52,7 @@ - +

ldap_bind_password: @@ -62,6 +62,96 @@ + + + +

: + + + + + + + + + +

: + + + + + + +

: + + + + + + +

1: + + + + + + +

2: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + +

: @@ -72,3 +162,7 @@ + + + + diff --git a/auth/ldap/lib.php b/auth/ldap/lib.php index b819626825..5dcc03d84b 100644 --- a/auth/ldap/lib.php +++ b/auth/ldap/lib.php @@ -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 - - $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'; + foreach ($fields as $field) { + if ($config["auth_user_$field"]) { + $moodleattributes[$field] = $config["auth_user_$field"]; + } + } + + $ldap_connection=auth_ldap_connect(); + $result = array(); $search_attribs = array(); + foreach ($moodleattributes as $key=>$value) { array_push($search_attribs, $value); } diff --git a/doc/release.html b/doc/release.html index 8d5ede895f..1c1844efd2 100644 --- a/doc/release.html +++ b/doc/release.html @@ -10,14 +10,16 @@

diff --git a/lang/en/auth.php b/lang/en/auth.php index dbc294ed58..86994ee70f 100644 --- a/lang/en/auth.php +++ b/lang/en/auth.php @@ -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 LDAP fields that you specify here.

If you leave these fields blank, then nothing will be transferred from LDAP and Moodle defaults will be used instead.

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.";