From 82913e540c5a497630ff5ef81b0172bd08064647 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 15 Mar 2010 16:35:30 +0000 Subject: [PATCH] Added new filter Method for OPI hosts git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16540 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_filterOPSIHOSTS.inc | 52 +++++++++++++++++++ .../admin/systems/class_filterSYSTEMS.inc | 38 -------------- .../systems/admin/systems/system-filter.xml | 4 ++ 3 files changed, 56 insertions(+), 38 deletions(-) create mode 100644 gosa-plugins/systems/admin/systems/class_filterOPSIHOSTS.inc diff --git a/gosa-plugins/systems/admin/systems/class_filterOPSIHOSTS.inc b/gosa-plugins/systems/admin/systems/class_filterOPSIHOSTS.inc new file mode 100644 index 000000000..767fe0cfd --- /dev/null +++ b/gosa-plugins/systems/admin/systems/class_filterOPSIHOSTS.inc @@ -0,0 +1,52 @@ +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); + $objects = array(); + if($opsi instanceof opsi && $opsi->enabled() && preg_match("/r/",$opsi_acl)){ + + // Get list of opsi hosts + $opsi_clients = $opsi->get_hosts_for_system_management(); + if($opsi->is_error()){ + 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])){ + $entry['objectClass'] = array("FAKE_OC_OpsiHost"); + $item = array('count' => count($entry)); + foreach($entry as $name => $value){ + $item[] = $name; + $item[$name] = $value; + } + $entries[] = $item; + } + } + } + } + } + return($entries); + } +} + +?> diff --git a/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc b/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc index 2d99d152f..aa7dfbdc5 100644 --- a/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc +++ b/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc @@ -104,44 +104,6 @@ class filterSYSTEMS { } } - // Append opsi stuff ... - global $config; - $ui = get_userinfo(); - if(preg_match("/FAIstate=__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),"* "); - } - - // Check ACLs and opsi handle - $opsi_acl = $ui->get_permissions($base,"opsi/opsiProperties"); - $opsi = new opsi($config); - $objects = array(); - if($opsi instanceof opsi && $opsi->enabled() && preg_match("/r/",$opsi_acl)){ - - // Get list of opsi hosts - $opsi_clients = $opsi->get_hosts_for_system_management(); - if($opsi->is_error()){ - 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])){ - $entry['objectClass'] = array("FAKE_OC_OpsiHost"); - $item = array('count' => count($entry)); - foreach($entry as $name => $value){ - $item[] = $name; - $item[$name] = $value; - } - $entries[] = $item; - } - } - } - } - } return($entries); } } diff --git a/gosa-plugins/systems/admin/systems/system-filter.xml b/gosa-plugins/systems/admin/systems/system-filter.xml index 48fa84796..380c57ab9 100644 --- a/gosa-plugins/systems/admin/systems/system-filter.xml +++ b/gosa-plugins/systems/admin/systems/system-filter.xml @@ -24,6 +24,10 @@ SYSTEMS (&(objectClass=goServer)(cn=$)) + + OPSIHOSTS + $ + cn 0.5 -- 2.30.2