From: hickert Date: Wed, 6 Jan 2010 10:17:13 +0000 (+0000) Subject: Updated FAI tp list opsi stuff again X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2022eb26ccf6e0b95a31058014d000a621ce87be;p=gosa.git Updated FAI tp list opsi stuff again git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15078 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 9a9b232e8..bc0fef35e 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -874,6 +874,33 @@ class faiManagement extends management } return(array()); } + + + /* Check if the given FAI class is used in this release + */ + static function check_class_name($oc,$name,$dn) + { + $base = FAI::get_release_dn($dn); + + if($oc == "FAIprofile"){ + $f = ""; + $ocs = array("FAIprofile","FAItemplate","FAIhook","FAIpartitionTable","FAIpackageList","FAIscript","FAIvariable"); + foreach($ocs as $oc){ + $f .= "(objectClass=".$oc.")"; + } + $res = FAI::get_all_objects_for_given_base($base,"(|".$f.")",TRUE); + }else{ + $res = FAI::get_all_objects_for_given_base($base,"(objectClass=".$oc.")",TRUE); + } + $delete = array(); + $used = array(); + foreach($res as $object){ + $used[$object['cn'][0]]= $object['cn'][0]; + } + return($used); + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-plugins/fai/admin/fai/class_filterFAI.inc b/gosa-plugins/fai/admin/fai/class_filterFAI.inc index 49d6d9a54..c8d8ef6f3 100644 --- a/gosa-plugins/fai/admin/fai/class_filterFAI.inc +++ b/gosa-plugins/fai/admin/fai/class_filterFAI.inc @@ -89,6 +89,58 @@ class filterFAI extends filterLDAP{ $entries[] = $item; } + + // Append opsi stuff ... + $opsi = new opsi($config); + + 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); + } + } + } + + foreach($objects as $name => $data) + { + $data = array_pop($data); + $item =array(); + + // FAKE_OC_IsBranch allows us to delete this entry (indicates NOT freezed state) + $item['objectClass'] = array('count' => 2, $data['type'], "FAKE_OC_IsBranch"); + $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); } }