Commit 717d8833e50e30e09a9f6dc53036f3c9214a673b
1 parent
58eecf42
merge conflict resolution
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@92 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
50 additions
and
6 deletions
lib/class.AuthLdap.php
| @@ -29,12 +29,12 @@ class AuthLdap { | @@ -29,12 +29,12 @@ class AuthLdap { | ||
| 29 | 29 | ||
| 30 | // 1.1 Public properties ----------------------------------------------------- | 30 | // 1.1 Public properties ----------------------------------------------------- |
| 31 | 31 | ||
| 32 | - var $server; // Array of server IP address or hostnames | ||
| 33 | - var $dn; // The base DN (e.g. "dc=foo,dc=com") | ||
| 34 | - var $people = "People"; // Where the user records are kept | ||
| 35 | - var $groups = "Groups"; // Where the group definitions are kept | ||
| 36 | - var $ldapErrorCode; // The last error code returned by the LDAP server | ||
| 37 | - var $ldapErrorText; // Text of the error message | 32 | + var $server; // Array of server IP address or hostnames |
| 33 | + var $dn; // The base DN (e.g. "dc=foo,dc=com") | ||
| 34 | + var $people; // Where the user records are kept | ||
| 35 | + var $groups; // Where the group definitions are kept | ||
| 36 | + var $ldapErrorCode; // The last error code returned by the LDAP server | ||
| 37 | + var $ldapErrorText; // Text of the error message | ||
| 38 | 38 | ||
| 39 | // 1.2 Private properties ---------------------------------------------------- | 39 | // 1.2 Private properties ---------------------------------------------------- |
| 40 | 40 | ||
| @@ -327,6 +327,35 @@ class AuthLdap { | @@ -327,6 +327,35 @@ class AuthLdap { | ||
| 327 | } | 327 | } |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | + /** | ||
| 331 | + * Sets and returns the appropriate dn, based on whether there | ||
| 332 | + * are values in $this->people and $this->groups. | ||
| 333 | + * | ||
| 334 | + * @param $peopleOrGroups | ||
| 335 | + * this boolean specifies whether to build a groups | ||
| 336 | + * dn or a people dn ie. if the boolean is true: | ||
| 337 | + * ou=$this->people,$this->dn else: | ||
| 338 | + * ou=$this->groups,$this->dn | ||
| 339 | + * @return | ||
| 340 | + * the dn to use | ||
| 341 | + */ | ||
| 342 | + function setDn( $peopleOrGroups) { | ||
| 343 | + | ||
| 344 | + if ( $peopleOrGroups) { | ||
| 345 | + if ( isset( $this->people) && ( strlen( $this->people) > 0)) { | ||
| 346 | + $checkDn = "ou=" .$this->people. ", " .$this->dn; | ||
| 347 | + } | ||
| 348 | + } else { | ||
| 349 | + if ( isset( $this->groups) && ( strlen( $this->groups) > 0)) { | ||
| 350 | + $checkDn = "ou=" .$this->groups. ", " .$this->dn; | ||
| 351 | + } | ||
| 352 | + } | ||
| 353 | + | ||
| 354 | + if ( !isset( $checkDn)) { | ||
| 355 | + $checkDn = $this->dn; | ||
| 356 | + } | ||
| 357 | + return $checkDn; | ||
| 358 | + } | ||
| 330 | // 2.5 User methods ---------------------------------------------------------- | 359 | // 2.5 User methods ---------------------------------------------------------- |
| 331 | 360 | ||
| 332 | function getUsers( $search, $attributeArray) { | 361 | function getUsers( $search, $attributeArray) { |
| @@ -344,11 +373,26 @@ class AuthLdap { | @@ -344,11 +373,26 @@ class AuthLdap { | ||
| 344 | for( $i = 0; $i < $info["count"]; $i++){ | 373 | for( $i = 0; $i < $info["count"]; $i++){ |
| 345 | // Get the username, and create an array indexed by it... | 374 | // Get the username, and create an array indexed by it... |
| 346 | // Modify these as you see fit. | 375 | // Modify these as you see fit. |
| 376 | +<<<<<<< class.AuthLdap.php | ||
| 377 | + $uname = $info[$i]["uid"][0]; | ||
| 378 | + // add to the array for each attribute in my list | ||
| 379 | + for ( $i = 0; $i < count( $attributeArray); $i++) { | ||
| 380 | + $userslist["$uname"]["$attributeArray[$i]"] = $info[$i][strtolower($attributeArra[$i])][0]; | ||
| 381 | + } | ||
| 382 | + /* | ||
| 383 | + $userslist["$uname"]["uid"] = $info[$i]["uid"][0]; | ||
| 384 | + $userslist["$uname"]["mail"] = $info[$i]["mail"][0]; | ||
| 385 | + $userslist["$uname"]["phone"] = $info[$i]["telephonenumber"][0]; | ||
| 386 | + $userslist["$uname"]["job"] = $info[$i]["employeetype"][0]; | ||
| 387 | + $userslist["$uname"]["entryid"] = $info[$i]["entryid"][0]; | ||
| 388 | + */ | ||
| 389 | +======= | ||
| 347 | $uname = $info[$i]["uid"][0]; | 390 | $uname = $info[$i]["uid"][0]; |
| 348 | // add to the array for each attribute in my list | 391 | // add to the array for each attribute in my list |
| 349 | for ( $i = 0; $i < count( $attributeArray); $i++) { | 392 | for ( $i = 0; $i < count( $attributeArray); $i++) { |
| 350 | $userslist["$uname"]["$attributeArray[$i]"] = $info[$i][strtolower($attributeArra[$i])][0]; | 393 | $userslist["$uname"]["$attributeArray[$i]"] = $info[$i][strtolower($attributeArra[$i])][0]; |
| 351 | } | 394 | } |
| 395 | +>>>>>>> 1.2 | ||
| 352 | } | 396 | } |
| 353 | 397 | ||
| 354 | if ( !@asort( $userslist)) { | 398 | if ( !@asort( $userslist)) { |