From: hickert Date: Wed, 31 Mar 2010 07:12:44 +0000 (+0000) Subject: Added opsi filter X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f9fd2ec02a47d6e2482076c70bc299be8f2138dd;p=gosa.git Added opsi filter git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17413 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index 5146f091e..2d00aedf6 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -86,7 +86,7 @@ class faiManagement extends management get_ou('faiTemplateRDN')); // Build filter - if (session::global_is_set(get_class($this)."_filter")){ + if (0 && session::global_is_set(get_class($this)."_filter")){ $filter= session::global_get(get_class($this)."_filter"); } else { $filter = new filter(get_template_path("fai-filter.xml", true)); diff --git a/gosa-plugins/fai/admin/fai/class_filterOPSIPackages.inc b/gosa-plugins/fai/admin/fai/class_filterOPSIPackages.inc new file mode 100644 index 000000000..19de355b5 --- /dev/null +++ b/gosa-plugins/fai/admin/fai/class_filterOPSIPackages.inc @@ -0,0 +1,74 @@ +get_ldap_link(); + $ldap->cd($config->current['BASE']); + + // Append opsi stuff ... + if(class_available('opsi') && $base == get_ou("faiBaseRDN").$config->current['BASE']){ + $opsi = new opsi($config); + $objects = array(); + if($opsi instanceof opsi && $opsi->enabled()){ + $opsi_acl = $ui->get_permissions($base,"opsi/opsiProperties"); + if(preg_match("/r/",$opsi_acl)){ + $err = FALSE; + + $n_pro = $opsi->get_netboot_products(); + $err |= $opsi->is_error(); + foreach($n_pro as $name => $data){ + $entry = array( + "cn" => $name, + "description" => $data['DESC'], + "type" => "opsi_netboot"); + $objects[$name]['opsi_netboot'] = $entry; + } + $l_pro = $opsi->get_local_products(); + $err |= $opsi->is_error(); + foreach($l_pro as $name => $data){ + $entry = array("cn" => $name, + "description" => $data['DESC'], + "type" => "opsi_local"); + $objects[$name]["opsi_local"] = $entry; + } + if($err){ + msg_dialog::display(_("Error"),msgPool::siError($opsi->get_error()),ERROR_DIALOG); + } + } + } + $cn_filter = ""; + if(preg_match("/^.*cn=([^)]*).*/",$filter)){ + $cn_filter = trim(preg_replace("/^.*cn=([^)]*).*/","\\1",$filter),"*"); + } + + foreach($objects as $name => $data) + { + $data = array_pop($data); + if(!empty($cn_filter) && !preg_match("/".preg_quote($cn_filter,'/')."/", $data['cn'])){ + continue; + } + $item =array(); + + $item['objectClass'] = array('count' => 2, $data['type'],"FAKE_OC_OPSI"); + $item[] = 'objectClass'; + $item['cn'] = $data['cn']; + $item[] = 'cn'; + $item['description'] = $data['description']; + $item[] = 'description'; + $item['dn'] = $data['cn']; + $item[] = 'dn'; + $item['TYPES'] = array($data['type']); + $item[] = 'TYPES'; + $item['count'] = '5'; + $entries[] = $item; + + } + } + return($entries); + } +} +?> diff --git a/gosa-plugins/fai/admin/fai/fai-filter.xml b/gosa-plugins/fai/admin/fai/fai-filter.xml index d90bdd20c..006a3d778 100644 --- a/gosa-plugins/fai/admin/fai/fai-filter.xml +++ b/gosa-plugins/fai/admin/fai/fai-filter.xml @@ -32,7 +32,7 @@ - FAI + OPSIPackages cn=$