LSldapObject : solve static/non-static problem on getObjectFilter() method

This commit is contained in:
Benjamin Renard 2019-03-12 12:19:44 +01:00
parent 01a25aa22a
commit b577fe23a9
2 changed files with 14 additions and 6 deletions

View file

@ -490,7 +490,7 @@ class LSldapObject {
$sfilter_user=NULL; $sfilter_user=NULL;
} }
if(isset($test['object_type']) && LSsession :: loadLSobject($test['object_type']) ) { if(isset($test['object_type']) && LSsession :: loadLSobject($test['object_type']) ) {
$sfilter=self :: getObjectFilter($test['object_type']); $sfilter=self :: _getObjectFilter($test['object_type']);
if ($sfilter_user) { if ($sfilter_user) {
$sfilter=LSldap::combineFilters('and',array($sfilter_user,$sfilter)); $sfilter=LSldap::combineFilters('and',array($sfilter_user,$sfilter));
@ -692,6 +692,17 @@ class LSldapObject {
$basedn.=','.$infos[$i]; $basedn.=','.$infos[$i];
return array($infos[0],$basedn); return array($infos[0],$basedn);
} }
/**
* Retourne le filtre correpondants aux objetcClass de l'objet courant
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @retval Net_LDAP2_Filter le filtre ldap correspondant au type de l'objet
*/
public function getObjectFilter() {
return self :: getObjectFilter($this -> type_name);
}
/** /**
* Retourne le filtre correpondants aux objetcClass de l'objet * Retourne le filtre correpondants aux objetcClass de l'objet
@ -700,10 +711,7 @@ class LSldapObject {
* *
* @retval Net_LDAP2_Filter le filtre ldap correspondant au type de l'objet * @retval Net_LDAP2_Filter le filtre ldap correspondant au type de l'objet
*/ */
public static function getObjectFilter($type=null) { public static function _getObjectFilter($type) {
if (is_null($type)) {
$type = $this -> type_name;
}
$oc=LSconfig::get("LSobjects.$type.objectclass"); $oc=LSconfig::get("LSobjects.$type.objectclass");
if(!is_array($oc)) return; if(!is_array($oc)) return;
$filters=array(); $filters=array();

View file

@ -752,7 +752,7 @@ class LSsearch {
} }
// Filter // Filter
$objFilter=LSldapObject::getObjectFilter($this -> LSobject); $objFilter=LSldapObject::_getObjectFilter($this -> LSobject);
if ($objFilter) { if ($objFilter) {
if (!is_null($retval['filter'])) { if (!is_null($retval['filter'])) {
$filter=LSldap::combineFilters('and',array($objFilter,$retval['filter'])); $filter=LSldap::combineFilters('and',array($objFilter,$retval['filter']));