From: hickert Date: Tue, 19 Aug 2008 12:33:36 +0000 (+0000) Subject: Added opsi classses. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e27d5cfb8cd306472c8e319f039ec444f64b21ea;p=gosa.git Added opsi classses. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12244 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/opsi/admin/opsi/class_opsi.inc b/gosa-plugins/opsi/admin/opsi/class_opsi.inc index 442539138..e41133b6d 100644 --- a/gosa-plugins/opsi/admin/opsi/class_opsi.inc +++ b/gosa-plugins/opsi/admin/opsi/class_opsi.inc @@ -22,28 +22,73 @@ /*! \brief This is the opsi base class, it handles . gosa daemon requests and prepares data for opsi plugins. */ -class opsi +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 static function opsi_get_netboot_products() + public function get_netboot_products($host = "") { - /* -
gosa_opsi_get_netboot_products
- GOSA - 00:01:6c:9d:b9:fa -
- -
gosa_opsi_get_netboot_products
- GOSA - GOSA - limux-cl-2.intranet.gonicus.de -
*/ + $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']){ + foreach($res['XML']['ITEM']['PRODUCTID'] as $id => $name){ + $items[$name]['NAME'] = $name; + $items[$name]['DESC'] = $res['XML']['ITEM']['DESCRIPTION'][$id]; + } + } + return($items); } @@ -51,20 +96,25 @@ class opsi @param @return */ - public static function gosa_opsi_get_local_products() + public function get_local_products($host = "") { - /* -
gosa_opsi_get_local_products
- GOSA - GOSA -
- -
gosa_opsi_get_local_products
- GOSA - GOSA - limux-cl-2.intranet.gonicus.de -
*/ + $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']){ + foreach($res['XML']['ITEM']['PRODUCTID'] as $id => $name){ + $items[$name]['NAME'] = $name; + $items[$name]['DESC'] = $res['XML']['ITEM']['DESCRIPTION'][$id]; + } + } + return($items); } @@ -74,7 +124,7 @@ class opsi @param @return */ - public static function gosa_opsi_get_product_properties() + public function get_product_properties() { /*
gosa_opsi_get_product_properties
@@ -90,6 +140,7 @@ class opsi limux-cl-2.intranet.gonicus.de
*/ + } @@ -97,7 +148,7 @@ class opsi @param @return */ - public static function gosa_opsi_set_product_properties() + public function set_product_properties() { /*
gosa_opsi_set_product_properties
@@ -128,7 +179,7 @@ class opsi @param @return */ - public static function gosa_opsi_get_client_hardware() + public function get_client_hardware() { /*
gosa_opsi_get_client_hardware
@@ -144,7 +195,7 @@ class opsi @param @return */ - public static function gosa_opsi_get_client_software() + public function get_client_software() { /*
gosa_opsi_get_client_software
@@ -160,14 +211,19 @@ class opsi @param @return */ - public static function gosa_opsi_list_clients() + public function list_clients() { - /* -
gosa_opsi_list_clients
- GOSA - 00:01:6c:9d:b9:fa -
- */ + $data = array(); + $res = $this->send_data("gosa_opsi_list_clients",$this->target,$data,TRUE); + $items = array(); + if(isset($res['XML']['ITEM'])){ + foreach($res['XML']['ITEM'] as $type => $val){ + foreach($val as $key => $value){ + $items[$key][$type] = $value; + } + } + } + return($items); } @@ -175,7 +231,7 @@ class opsi @param @return */ - public static function gosa_opsi_del_client() + public function del_client() { /*
gosa_opsi_del_client
@@ -191,7 +247,7 @@ class opsi @param @return */ - public static function job_opsi_install_client() + public function job_opsi_install_client() { /*
job_opsi_install_client
@@ -208,7 +264,7 @@ class opsi @param @return */ - public static function gosa_opsi_add_client() + public function add_client() { /*
gosa_opsi_add_client
@@ -228,7 +284,7 @@ class opsi @param @return */ - public static function gosa_opsi_add_product_to_client() + public function add_product_to_client() { /*
gosa_opsi_add_product_to_client
@@ -246,7 +302,7 @@ class opsi @param @return */ - public static function gosa_opsi_del_product_from_client() + public function del_product_from_client() { /*
gosa_opsi_del_product_from_client
@@ -259,6 +315,5 @@ class opsi */ } } - // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-plugins/opsi/admin/opsi/class_opsi_generic.inc b/gosa-plugins/opsi/admin/opsi/class_opsi_generic.inc new file mode 100644 index 000000000..7f0da6858 --- /dev/null +++ b/gosa-plugins/opsi/admin/opsi/class_opsi_generic.inc @@ -0,0 +1,10 @@ + diff --git a/gosa-plugins/opsi/admin/opsi/opsi_tabs.inc b/gosa-plugins/opsi/admin/opsi/opsi_tabs.inc new file mode 100644 index 000000000..23145e44e --- /dev/null +++ b/gosa-plugins/opsi/admin/opsi/opsi_tabs.inc @@ -0,0 +1,10 @@ +