From bf40c45dbfa7ea737f473a970b0658816e785a53 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 15 Mar 2010 16:44:05 +0000 Subject: [PATCH] Enabled extra opsi host qurey git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16541 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_filterOPSIHOSTS.inc | 20 +++++++++---------- .../systems/admin/systems/system-filter.xml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gosa-plugins/systems/admin/systems/class_filterOPSIHOSTS.inc b/gosa-plugins/systems/admin/systems/class_filterOPSIHOSTS.inc index 767fe0cfd..d8e47a892 100644 --- a/gosa-plugins/systems/admin/systems/class_filterOPSIHOSTS.inc +++ b/gosa-plugins/systems/admin/systems/class_filterOPSIHOSTS.inc @@ -7,19 +7,18 @@ class filterOPSIHOSTS { // Append opsi stuff ... global $config; $ui = get_userinfo(); + $entries = array(); - echo $filter; - if(preg_match("/NETBOOT/", $filter) && - class_available('opsi') && - $base == $config->current['BASE']){ + - // Get filter regex ... - $regex = ""; - if(preg_match("/\(cn=[^\)\$]*\)/", $filter)){ - $regex = trim(preg_replace("/^.*\(cn=([^\)\$]*)\).*$/","\\1", $filter),"* "); - } + if(class_available('opsi') && $base == $config->current['BASE']){ + $attr = $value = ""; + if(preg_match("/=/", $filter)) { + list($fAttr,$fValue) = preg_split("/=/", $filter); + } + // Check ACLs and opsi handle $opsi_acl = $ui->get_permissions($base,"opsi/opsiProperties"); $opsi = new opsi($config); @@ -32,7 +31,8 @@ class filterOPSIHOSTS { msg_dialog::display(_("Error"),msgPool::siError($opsi->get_error()),ERROR_DIALOG); }else{ foreach($opsi_clients as $entry){ - if(empty($regex) || preg_match('/'.preg_quote($regex,'/').'/i',$entry['cn'][0])){ + + if(empty($fAttr) || preg_match("/{$fValue}/i",$entry[$fAttr][0])){ $entry['objectClass'] = array("FAKE_OC_OpsiHost"); $item = array('count' => count($entry)); foreach($entry as $name => $value){ diff --git a/gosa-plugins/systems/admin/systems/system-filter.xml b/gosa-plugins/systems/admin/systems/system-filter.xml index 380c57ab9..1f24590bc 100644 --- a/gosa-plugins/systems/admin/systems/system-filter.xml +++ b/gosa-plugins/systems/admin/systems/system-filter.xml @@ -26,7 +26,7 @@ OPSIHOSTS - $ + cn=$ cn -- 2.30.2