. */ /******** __construct($config) get_hosts_for_system_management() get_netboot_products($host = "") get_local_products($host = "") get_product_properties() set_product_properties() get_client_hardware() get_client_software() list_clients() del_client() job_opsi_install_client() add_client() add_product_to_client() del_product_from_client() ********/ /*! \brief This is the opsi base class, it handles . gosa daemon requests and prepares data for opsi plugins. */ class opsi extends gosaSupportDaemon { private $config = NULL; /*! \brief Create opsi object. @param @return */ public function __construct($config) { $this->config = $config; gosaSupportDaemon::__construct($config); $this->target = "00:01:6c:9d:b9:fa"; } /****************** Opsi handling ******************/ function get_hosts_for_system_management() { $res = $this->list_clients(); $data = array(); foreach($res as $entry){ $data[] = array( "dn" => "opsi:=".$entry['NAME'].",".get_ou("winstations").$this->config->current['BASE'], "objectClass" => array("gosa_opsi_client"), "cn" => array(0 => $entry['NAME']), "description" => array(0 => $entry['DESCRIPTION']), "macAddress" => array(0 => $entry['MAC']), "opsi_notes" => array(0 => $entry['NOTES'])); } return($data); } /****************** SI Communication functions ******************/ /*! \brief Returns a list of netboot products. @param @return */ public function get_netboot_products($host = "") { $data = array(); /* Append host attribute to query data */ if(!empty($host)){ $data['hostId'] = trim($host); } $res = $this->send_data("gosa_opsi_get_netboot_products",$this->target,$data,TRUE); $items = array(); if($res['XML']['ITEM']['PRODUCTID']){ if(!is_array($res['XML']['ITEM']['PRODUCTID'])){ $items[$res['XML']['ITEM']['PRODUCTID']]['NAME'] = $res['XML']['ITEM']['PRODUCTID']; $items[$res['XML']['ITEM']['PRODUCTID']]['DESC'] = $res['XML']['ITEM']['DESCRIPTION']; }else{ foreach($res['XML']['ITEM']['PRODUCTID'] as $id => $name){ $items[$name]['NAME'] = $name; $items[$name]['DESC'] = $res['XML']['ITEM']['DESCRIPTION'][$id]; } } } return($items); } /*! \brief Returns a list of all local products. @param @return */ public function get_local_products($host = "") { $data = array(); /* Append host attribute to query data */ if(!empty($host)){ $data['hostId'] = trim($host); } $res = $this->send_data("gosa_opsi_get_local_products",$this->target,$data,TRUE); $items = array(); if($res['XML']['ITEM']['PRODUCTID']){ if(!is_array($res['XML']['ITEM']['PRODUCTID'])){ $items[$res['XML']['ITEM']['PRODUCTID']]['NAME'] = $res['XML']['ITEM']['PRODUCTID']; $items[$res['XML']['ITEM']['PRODUCTID']]['DESC'] = $res['XML']['ITEM']['DESCRIPTION']; }else{ foreach($res['XML']['ITEM']['PRODUCTID'] as $id => $name){ $items[$name]['NAME'] = $name; $items[$name]['DESC'] = $res['XML']['ITEM']['DESCRIPTION'][$id]; } } } return($items); } /*! \brief Returns a list of all product properties. \ . Additionally you can specify the host parameter to \ . get host specific product properties @param @return */ public function get_product_properties($productId,$hostId = "") { $data = array("productId" => $productId); /* Append host attribute to query data */ if(!empty($hostId)){ $data['hostId'] = trim($hostId); } /* Check parameter */ if(empty($productId)){ trigger_error("No valid product id given, check parameter 1."); return(array()); } /* Query SI server */ $res = $this->send_data("gosa_opsi_get_product_properties",$this->target,$data,TRUE); if(isset($res['XML']['ITEM'])){ return($res['XML']['ITEM']); } return(array()); } /*! \brief Set product properties, globally or per host. @param @return */ public function set_product_properties() { /*
gosa_opsi_set_product_properties
GOSA 00:01:6c:9d:b9:fa firefox askbeforeinst false
gosa_opsi_set_product_properties
GOSA 00:01:6c:9d:b9:fa limux-cl-2.intranet.gonicus.de firefox askbeforeinst false
*/ } /*! \brief Returns the clients hardware setup. @param @return */ public function get_client_hardware() { /*
gosa_opsi_get_client_hardware
GOSA GOSA limux-cl-2.intranet.gonicus.de
*/ } /*! \brief Returns the clients software setup. @param @return */ public function get_client_software() { /*
gosa_opsi_get_client_software
GOSA GOSA limux-cl-2.intranet.gonicus.de
i */ } /*! \brief Returns a list of all opsi clients. @param @return */ public function list_clients() { $data = array(); $res = $this->send_data("gosa_opsi_list_clients",$this->target,$data,TRUE); $items = array(); if(isset($res['XML']['ITEM'])){ if(!is_array($res['XML']['ITEM']['NAME'])){ $obj = $res['XML']['ITEM']; $items[$obj['NAME']] = $obj; }else{ foreach($res['XML']['ITEM'] as $type => $val){ foreach($val as $key => $value){ $items[$key][$type] = $value; } } } } return($items); } /*! \brief Deletes the given opsi client. @param @return */ public function del_client() { /*
gosa_opsi_del_client
GOSA 00:01:6c:9d:b9:fa limux-cl-2.intranet.gonicus.de
*/ } /*! \brief Triggers install/reinstall of an opsi client. @param @return */ public function job_opsi_install_client() { /*
job_opsi_install_client
GOSA 00:01:6c:9d:b9:fa limux-cl-2.intranet.gonicus.de 00:11:25:4b:8c:e5
*/ } /*! \brief Adds a new opsi client. @param @return */ public function add_client() { /*
gosa_opsi_add_client
GOSA 00:01:6c:9d:b9:fa limux-cl-2.intranet.gonicus.de 00:11:25:4b:8c:e5 Test halt 1.2.3.4 Im a note
*/ } /*! \brief Adds a given product to a client. @param @return */ public function add_product_to_client() { /*
gosa_opsi_add_product_to_client
GOSA 00:01:6c:9d:b9:fa 00:11:25:4b:8c:e5 limux-cl-2.intranet.gonicus.de winxppro
*/ } /*! \brief Removes a given product from a client. @param @return */ public function del_product_from_client() { /*
gosa_opsi_del_product_from_client
GOSA 00:01:6c:9d:b9:fa limux-cl-1.intranet.gonicus.de 00:11:25:4b:8c:e5 softprod
*/ } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>