From 7ae02cb45127d157778ac9647b0a0ea6cbf2dbdb Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 5 Nov 2009 11:21:45 +0000 Subject: [PATCH] Added additional filter git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14757 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_filter.inc | 2 +- gosa-core/include/class_filterGroupLDAP.inc | 52 +++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 gosa-core/include/class_filterGroupLDAP.inc diff --git a/gosa-core/include/class_filter.inc b/gosa-core/include/class_filter.inc index 365f9da63..64cfded3d 100644 --- a/gosa-core/include/class_filter.inc +++ b/gosa-core/include/class_filter.inc @@ -465,7 +465,7 @@ class filter { } // Make filter - $filter= preg_replace("/\\$$tag/", normalizeLDAP($value), $filter); + $filter= preg_replace("/\\$$tag/", normalizeLdap($value), $filter); if (isset($config['base']) && isset($config['scope']) && isset($config['category'])) { $result= call_user_func(array($backend, 'query'), $config['base'], $config['scope'], $filter, $attributes, $config["category"], $config["objectStorage"]); diff --git a/gosa-core/include/class_filterGroupLDAP.inc b/gosa-core/include/class_filterGroupLDAP.inc new file mode 100644 index 000000000..9be6f569e --- /dev/null +++ b/gosa-core/include/class_filterGroupLDAP.inc @@ -0,0 +1,52 @@ +get_ldap_link(TRUE); + $flag= ($scope == "sub")?GL_SUBSEARCH:0; + $tmp= filterGroupLDAP::get_list($base, $filter, $attributes, $category, $objectStorage, $flag | GL_SIZELIMIT); + + // Sort out menu entries, but save info + $index= 0; + foreach ($tmp as $entry) { + if (in_array_ics("posixGroup", $entry['objectClass'])) { + $result[$index]= $entry; + $dn2index[$entry['dn']]= $index; + $index++; + } else { + foreach ($objectStorage as $storage) { + $group= preg_replace("/^.*,([^,]+),".preg_quote("$storage$base")."$/", '$1', $entry['dn']); + $group= "$group,$storage$base"; + + // The current group implementation has no multiple storage settings - so break here + break; + } + $menu[$group]= true; + } + } + + // Move menu information to menu + foreach ($menu as $dn => $dummy) { + $result[$dn2index[$dn]]["objectClass"][]= "gotoMenuGroup"; + } + + return $result; + } + + + static function get_list($base, $filter, $attributes, $category, $objectStorage, $flags= GL_SUBSEARCH) + { + $filter= "(|(|(objectClass=gotoMenuEntry)(objectClass=gotoSubmenuEntry))$filter)"; + return filterLDAP::get_list($base, $filter, $attributes, $category, $objectStorage, $flags); + } + + +} + +?> -- 2.30.2