From 2cba62d29208d29b353ac50e45cbbf81c1868895 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 12 Jan 2010 13:22:18 +0000 Subject: [PATCH] filter opsi hosts too git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15161 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_filterSYSTEMS.inc | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc b/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc index 22010af05..8a620e5a7 100644 --- a/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc +++ b/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc @@ -106,6 +106,12 @@ class filterSYSTEMS { class_available('opsi') && $base == $config->current['BASE']){ + // Get filter regex ... + $regex = ""; + if(preg_match("/\(cn=[^\)\$]*\)/", $filter)){ + $regex = trim(preg_replace("/^.*\(cn=([^\)\$]*)\).*$/","\\1", $filter),"* "); + } + // Check ACLs and opsi handle $opsi_acl = $ui->get_permissions($base,"opsi/opsiProperties"); $opsi = new opsi($config); @@ -118,13 +124,15 @@ class filterSYSTEMS { msg_dialog::display(_("Error"),msgPool::siError($opsi->get_error()),ERROR_DIALOG); }else{ foreach($opsi_clients as $entry){ - $entry['objectClass'] = array("FAKE_OC_OpsiHost"); - $item = array('count' => count($entry)); - foreach($entry as $name => $value){ - $item[] = $name; - $item[$name] = $value; + if(empty($regex) || preg_match('/'.preg_quote($regex,'/').'/i',$entry['cn'])){ + $entry['objectClass'] = array("FAKE_OC_OpsiHost"); + $item = array('count' => count($entry)); + foreach($entry as $name => $value){ + $item[] = $name; + $item[$name] = $value; + } + $entries[] = $item; } - $entries[] = $item; } } } -- 2.30.2