Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Moved configuration defaults to new function auth_ldap_getdefaults()

Now the information can be used anywhere. config.html comes to mind at first.
  • Loading branch information...
commit 2be3872c88d7f2a56691b83f451737f61ce1fd9f 1 parent 16aede7
authored October 01, 2004

Showing 1 changed file with 30 additions and 19 deletions. Show diff stats Hide diff stats

  1. 49  auth/ldap/lib.php
49  auth/ldap/lib.php
@@ -33,11 +33,10 @@
33 33
  * Returns true if the username and password work
34 34
  * and false if they don't
35 35
  *
36  
- * @param string  username
37  
- * @param string  plaintext password
  36
+ * @param string  $username
  37
+ * @param string  $password
38 38
  *
39 39
  */
40  
-
41 40
 function auth_user_login ($username, $password) {
42 41
 
43 42
     global $CFG;
@@ -249,13 +248,13 @@ function auth_get_users($filter='*') {
249 248
 }
250 249
 
251 250
 /**
252  
- * return number of daysi to user users password expires
  251
+ * return number of days to user password expires
253 252
  *
254 253
  * If userpassword does not expire it should return 0. If password is already expired
255 254
  * it should return negative value.
256 255
  *
257  
- * @param mixed $username    username
258  
- *
  256
+ * @param mixed $username username
  257
+ * @return integer
259 258
  */
260 259
 function auth_password_expire($username) {
261 260
     global $CFG ;
@@ -443,7 +442,7 @@ function auth_sync_users ($firstsync=0, $unsafe_optimizations = false, $bulk_ins
443 442
  * Activates (enables) user in external db so user can login to external db
444 443
  *
445 444
  * @param mixed $username    username
446  
- *
  445
+ * @return boolen result
447 446
  */
448 447
 function auth_user_activate ($username) {
449 448
 	global $CFG;
@@ -465,7 +464,7 @@ function auth_user_activate ($username) {
465 464
  * Disables user in external db so user can't login to external db
466 465
  *
467 466
  * @param mixed $username    username
468  
- *
  467
+ * @return boolean result
469 468
  */
470 469
 function auth_user_disable ($username) {
471 470
 	global $CFG;
@@ -486,7 +485,7 @@ function auth_user_disable ($username) {
486 485
  * auth_iscreator returns true if user should be coursecreator
487 486
  *
488 487
  * @param mixed $username    username
489  
- * @return
  488
+ * @return boolean result
490 489
  */
491 490
 function auth_iscreator($username=0) {
492 491
 ///if user is member of creator group return true
@@ -514,7 +513,7 @@ function auth_iscreator($username=0) {
514 513
  *
515 514
  * @param mixed $olduser     Userobject before modifications
516 515
  * @param mixed $newuser     Userobject new modified userobject
517  
- * @return
  516
+ * @return boolean result
518 517
  *
519 518
  */
520 519
 function auth_user_update($olduser, $newuser) {
@@ -570,14 +569,14 @@ function auth_user_update($olduser, $newuser) {
570 569
 }
571 570
 
572 571
 /*
573  
- * auth_user_update_password changes userpassword in external db
  572
+ * changes userpassword in external db
574 573
  *
575 574
  * called when the user password is updated.
576 575
  * changes userpassword in external db
577 576
  *
578 577
  * @param mixed $username    Username
579 578
  * @param mixed $newpassword Plaintext password
580  
- * @return
  579
+ * @return boolean result
581 580
  *
582 581
  */
583 582
 function auth_user_update_password($username, $newpassword) {
@@ -616,7 +615,7 @@ function auth_user_update_password($username, $newpassword) {
616 615
 /**
617 616
  * returns predefined usertypes
618 617
  *
619  
- * @return
  618
+ * @return array of predefined usertypes
620 619
  */
621 620
 
622 621
 function auth_ldap_suppported_usertypes (){
@@ -643,12 +642,10 @@ function auth_ldap_suppported_usertypes (){
643 642
  *                      ....
644 643
  *                      );
645 644
  *
646  
- * And acording this information $CFG->pseudoname values are set
647  
- * If $CFG->pseudoname is alredy set curren value is honored.
648  
- *
  645
+ * @return array of default values
649 646
  */
650  
-function auth_ldap_init () {
651  
-    global $CFG;
  647
+
  648
+function auth_ldap_getdefaults(){
652 649
     $default['ldap_objectclass'] = array(
653 650
                         'edir' => 'User',
654 651
                         'rfc2703' => 'posixAccount',
@@ -689,8 +686,22 @@ function auth_ldap_init () {
689 686
                         'ad' => '', //No support yet
690 687
                         'default' => ''
691 688
                         );
692  
-  
  689
+    return $default; 
  690
+}
693 691
 
  692
+/**
  693
+ * set $CFG-values for ldap_module
  694
+ * 
  695
+ * Get default configuration values with auth_ldap_getdefaults() 
  696
+ * and by using this information $CFG-> values are set
  697
+ * If $CFG->value is alredy set current value is honored.
  698
+ *
  699
+ * 
  700
+ */
  701
+function auth_ldap_init () {
  702
+    global $CFG;
  703
+ 
  704
+    $default = auth_ldap_getdefaults();
694 705
 
695 706
     foreach ($default as $key => $value) {
696 707
         //set defaults if overriding fields not set

0 notes on commit 2be3872

Please sign in to comment.
Something went wrong with that request. Please try again.