Commit d2c0bb581c15920c442eaef326206db5a044a960
1 parent
376eadbf
corrected ldap searching / selecting bug
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1509 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
37 additions
and
20 deletions
presentation/lookAndFeel/knowledgeTree/administration/usermanagement/addUserBL.php
| ... | ... | @@ -13,6 +13,7 @@ if (checkSession()) { |
| 13 | 13 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); |
| 14 | 14 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); |
| 15 | 15 | require_once("addUserUI.inc"); |
| 16 | + require_once("../adminUI.inc"); | |
| 16 | 17 | require_once("$default->fileSystemRoot/lib/users/User.inc"); |
| 17 | 18 | require_once("$default->fileSystemRoot/lib/security/permission.inc"); |
| 18 | 19 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| ... | ... | @@ -23,23 +24,24 @@ if (checkSession()) { |
| 23 | 24 | |
| 24 | 25 | $oPatternCustom = & new PatternCustom(); |
| 25 | 26 | //create db object |
| 26 | - $oDbAuth = new $default->authenticationClass; | |
| 27 | - | |
| 27 | + $oAuth = new $default->authenticationClass; | |
| 28 | + // user attributes to search for | |
| 29 | + if ($default->authenticationClass == "DBAuthenticator") { | |
| 30 | + $aAttributes = array ("username", "name", "email", "mobile", "email_notification", "sms_notification"); | |
| 31 | + $bLdap = false; | |
| 32 | + } else { | |
| 33 | + //if its using LDAP get these attributes | |
| 34 | + $aAttributes = array ("dn", "uid", "givenname", "sn", "mail", "mobile"); | |
| 35 | + $bLdap = true; | |
| 36 | + } | |
| 37 | + | |
| 28 | 38 | if (isset($fSearch)) { |
| 29 | 39 | //get user name |
| 30 | 40 | $sSearch = $fName; |
| 31 | 41 | |
| 32 | - // user attributes to search for | |
| 33 | - if ($default->authenticationClass == "DBAuthenticator") { | |
| 34 | - $aAttributes = array ("username", "name", "email", "mobile", "email_notification", "sms_notification"); | |
| 35 | - $aResults = $oDbAuth->searchUsers($sSearch, $aAttributes); | |
| 36 | - $bLdap = false; | |
| 37 | - } else { | |
| 38 | - //if its using LDAP get these attributes | |
| 39 | - $aAttributes = array ("dn", "uid", "givenname", "sn", "mail", "mobile"); | |
| 40 | - $aResults = $oDbAuth->searchUsers($sSearch, $aAttributes); | |
| 41 | - $bLdap = true; | |
| 42 | - } | |
| 42 | + // search for users | |
| 43 | + $aResults = $oAuth->searchUsers($sSearch, $aAttributes); | |
| 44 | + | |
| 43 | 45 | //post array to page |
| 44 | 46 | if(isset($aResults)) { |
| 45 | 47 | if(count($aResults) == 0) { |
| ... | ... | @@ -48,14 +50,14 @@ if (checkSession()) { |
| 48 | 50 | if (count($aResults) > 1) { |
| 49 | 51 | // display results in a listbox |
| 50 | 52 | $oPatternCustom->setHtml(getSelectUserPage($aResults)); |
| 51 | - $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1&fFromDb=1&fSearch=1"); | |
| 53 | + $main->setFormAction($_SERVER["PHP_SELF"]. "?fSelectedUser=1"); | |
| 52 | 54 | } else { |
| 53 | - if($bLdap == false) { | |
| 54 | - $oPatternCustom->setHtml(getDetailsDBPage($sSearch,$aResults)); | |
| 55 | - $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1&fFromDb=1"); | |
| 56 | - } else { | |
| 55 | + if($bLdap) { | |
| 57 | 56 | $oPatternCustom->setHtml(getDetailsLDAPPage($sSearch,$aResults)); |
| 58 | 57 | $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1"); |
| 58 | + } else { | |
| 59 | + $oPatternCustom->setHtml(getDetailsDBPage($sSearch,$aResults)); | |
| 60 | + $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1&fFromDb=1"); | |
| 59 | 61 | } |
| 60 | 62 | } |
| 61 | 63 | } |
| ... | ... | @@ -64,14 +66,29 @@ if (checkSession()) { |
| 64 | 66 | $oPatternCustom->setHtml(getAddPageFail()); |
| 65 | 67 | $main->setFormAction($_SERVER["PHP_SELF"]); |
| 66 | 68 | } |
| 67 | - } else if(isset($fAddToDb)) { //if db authentication | |
| 69 | + } else if (isset($fSelectedUser)) { | |
| 70 | + // user has been selected | |
| 71 | + | |
| 72 | + // retrieve user details | |
| 73 | + $aResult = $oAuth->getUser($fName, $aAttributes); | |
| 74 | + // display details page | |
| 75 | + if ($bLdap) { | |
| 76 | + $oPatternCustom->setHtml(getDetailsLDAPPage($fName,$aResult)); | |
| 77 | + $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1"); | |
| 78 | + } else { | |
| 79 | + $oPatternCustom->setHtml(getDetailsDBPage($fName,$aResult)); | |
| 80 | + $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1&fFromDb=1"); | |
| 81 | + } | |
| 82 | + | |
| 83 | + } else if(isset($fAddToDb)) { | |
| 84 | + // if db authentication | |
| 68 | 85 | if(isset($fFromDb)) { |
| 69 | 86 | |
| 70 | 87 | //User($sNewUserName, $sNewName, $sNewPassword, $iNewQuotaMax, $sNewEmail, $sNewMobile, $bNewEmailNotification, $bNewSmsNotification, $sNewLdapDn, $iNewMaxSessions, $iNewLanguageID) |
| 71 | 88 | $oUser = new User($fUsername,$fName,0,0,$fEmail,$fMobile,$fEmailNotification,$fSmsNotification,0,1,0); |
| 72 | 89 | |
| 73 | 90 | } else { |
| 74 | - $oUser = new User($fUsername,$fName,0,0,$fEmail,$fMobile,1,0,$fLdap,1,0); | |
| 91 | + $oUser = new User($fUsername,$fName,0,0,$fEmail,$fMobile,$fEmailNotification,$fSmsNotification,$fLdap,1,0); | |
| 75 | 92 | } |
| 76 | 93 | |
| 77 | 94 | if($oUser->create()) { | ... | ... |