Commit 3a0599e20f9ca155dfc4049fd4f5f8b4cf185bae
1 parent
4be98d5b
KTS-3090
"Get an error when trying to view all groups on your active directory server." Fixed. Added error checking. Committed by: Megan Watson Reviewed by: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8179 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
10 additions
and
1 deletions
plugins/ktstandard/ldap/ldapbaseauthenticationprovider.inc.php
| @@ -504,11 +504,15 @@ class KTLDAPBaseAuthenticationProvider extends KTAuthenticationProvider { | @@ -504,11 +504,15 @@ class KTLDAPBaseAuthenticationProvider extends KTAuthenticationProvider { | ||
| 504 | $fields = array(); | 504 | $fields = array(); |
| 505 | $fields[] = new KTStringWidget(_kt("Group's name"), _kt("The group's name, or part thereof, to find the group that you wish to add"), 'name', '', $this->oPage, true); | 505 | $fields[] = new KTStringWidget(_kt("Group's name"), _kt("The group's name, or part thereof, to find the group that you wish to add"), 'name', '', $this->oPage, true); |
| 506 | 506 | ||
| 507 | - $oAuthenticator = $this->getAuthenticator($oSource); | ||
| 508 | $name = KTUtil::arrayGet($_REQUEST, 'name'); | 507 | $name = KTUtil::arrayGet($_REQUEST, 'name'); |
| 509 | if (!empty($name)) { | 508 | if (!empty($name)) { |
| 510 | $oAuthenticator = $this->getAuthenticator($oSource); | 509 | $oAuthenticator = $this->getAuthenticator($oSource); |
| 511 | $aSearchResults = $oAuthenticator->searchGroups($name); | 510 | $aSearchResults = $oAuthenticator->searchGroups($name); |
| 511 | + | ||
| 512 | + if(PEAR::isError($aSearchResults)){ | ||
| 513 | + $this->addErrorMessage($aSearchResults->getMessage()); | ||
| 514 | + $aSearchResults = array(); | ||
| 515 | + } | ||
| 512 | } | 516 | } |
| 513 | 517 | ||
| 514 | $aTemplateData = array( | 518 | $aTemplateData = array( |
| @@ -973,6 +977,11 @@ class KTLDAPBaseAuthenticator extends Authenticator { | @@ -973,6 +977,11 @@ class KTLDAPBaseAuthenticator extends Authenticator { | ||
| 973 | } | 977 | } |
| 974 | $sFilter = sprintf('(&(objectClass=group)(cn=*%s*))', $sSearch); | 978 | $sFilter = sprintf('(&(objectClass=group)(cn=*%s*))', $sSearch); |
| 975 | $oResults = $this->oLdap->search($rootDn, $sFilter, $aParams); | 979 | $oResults = $this->oLdap->search($rootDn, $sFilter, $aParams); |
| 980 | + | ||
| 981 | + if(PEAR::isError($oResults)){ | ||
| 982 | + return $oResults; | ||
| 983 | + } | ||
| 984 | + | ||
| 976 | $aRet = array(); | 985 | $aRet = array(); |
| 977 | foreach($oResults->entries() as $oEntry) { | 986 | foreach($oResults->entries() as $oEntry) { |
| 978 | $aAttr = $oEntry->attributes(); | 987 | $aAttr = $oEntry->attributes(); |