]> git.mjollnir.org Git - moodle.git/commitdiff
Added full configuration to LDAP (ie transferrable fields etc)
authormoodler <moodler>
Thu, 21 Nov 2002 11:27:44 +0000 (11:27 +0000)
committermoodler <moodler>
Thu, 21 Nov 2002 11:27:44 +0000 (11:27 +0000)
auth/ldap/README-LDAP
auth/ldap/config.html
auth/ldap/lib.php
doc/release.html
lang/en/auth.php

index 8cea11cd82e72647d46f30ece75d87be6ef1d497..c51d4529171cf95358a73ce7ee36f58b55d6d984 100644 (file)
@@ -2,39 +2,3 @@ LDAP-module README
 07.10.2002 Version 0.1, Petri Asikainen <paca@sci.fi>
 
 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.
-
-
-
index 9ca38164f523b9e45af09818677cbed407b31840..aff826833089cdd9f9b621107e0fb61e02156f60 100644 (file)
@@ -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?>">
     </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>
     <? helpbutton("text", get_string("helptext")) ?>
     </TD>
 </TR>
+
+
+
+
index b8196268257382339ce8ef89407f0039f9c1e323..5dcc03d84bf06ee57f16f332ce53aecc36c96bf0 100644 (file)
@@ -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);
   }
index 8d5ede895f1cf2bd33ff6ab7e5225179390a7e6c..1c1844efd25b24693a95aa98ce5189e2d575c4b0 100644 (file)
 <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>
index dbc294ed5814b17a6ae74c40fd44f33b9dd07d65..86994ee70f088811aec7730c3aa2dd7213305b0c 100644 (file)
@@ -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 \r
                                   wanted fields in Moodle.  For following logins only the username and \r
                                   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.";