From 2671e726aa955ee067bfe26e42ee3245ce83839c Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 19 Jun 2008 07:33:29 +0000 Subject: [PATCH] Updated DAK. - Added templates. - Added some keyring functionality. Add/REmove keys. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11361 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-plugins/dak/addons/dak/class_DAK.inc | 110 ++++++++++++++++++ .../dak/addons/dak/class_dak_keyring.inc | 2 +- .../dak/addons/dak/class_dak_queue.inc | 1 - gosa-plugins/dak/addons/dak/dak_keyring.tpl | 33 ++++++ gosa-plugins/dak/addons/dak/dak_queue.tpl | 20 ++++ 5 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 gosa-plugins/dak/addons/dak/class_DAK.inc create mode 100644 gosa-plugins/dak/addons/dak/dak_keyring.tpl create mode 100644 gosa-plugins/dak/addons/dak/dak_queue.tpl diff --git a/gosa-plugins/dak/addons/dak/class_DAK.inc b/gosa-plugins/dak/addons/dak/class_DAK.inc new file mode 100644 index 000000000..fdeff60f6 --- /dev/null +++ b/gosa-plugins/dak/addons/dak/class_DAK.inc @@ -0,0 +1,110 @@ +get_ldap_link(); + $ldap->cd($config->current['BASE']); + $ldap->search("(&(macAddress=*)(FAIrepository=*)(objectClass=FAIrepositoryServer))",array("cn","FAIrepository","macAddress")); + while($attrs = $ldap->fetch()){ + for($i = 0 ; $i < $attrs['FAIrepository']['count'] ; $i ++){ + list($url,$parent,$release,$sections) = explode("|",$attrs['FAIrepository'][$i]); + $repo['SECTIONS'] = split(",",$sections); + $repo['SERVER'] = $attrs['cn'][0]; + $repo['RELEASE'] = $release; + $repo['MAC'] = $attrs['macAddress'][0]; + $repo['PARENT'] = $parent; + $repo['URL'] = $url; + $repo['DN'] = $attrs['dn']; + $res[] = $repo; + } + } + return($res); + } + + + public static function get_repositories_by_server($config) + { + if(!$config instanceOf config){ + trigger_error("Invalid config object given, aborting."); + return; + } + $res = array(); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); + $ldap->search("(&(macAddress=*)(FAIrepository=*)(objectClass=FAIrepositoryServer))",array("cn","FAIrepository","macAddress")); + while($attrs = $ldap->fetch()){ + $serv = array(); + $serv['REPOSITORIES'] = array(); + for($i = 0 ; $i < $attrs['FAIrepository']['count'] ; $i ++){ + list($url,$parent,$release,$sections) = explode("|",$attrs['FAIrepository'][$i]); + $repo['SECTIONS'] = split(",",$sections); + $repo['RELEASE'] = $release; + $repo['PARENT'] = $parent; + $repo['URL'] = $url; + $serv['REPOSITORIES'] [] = $repo; + } + $serv['MAC'] = $attrs['macAddress'][0]; + $serv['DN'] = $attrs['dn']; + $serv['SERVER'] = $attrs['cn'][0]; + $res[] = $serv; + } + return($res); + } + + + /*! \brief Returns all */ + public static function list_keys($server) + { + $o_queue = new gosaSupportDaemon(); + $data = $o_queue->DAK_get_queue_entries($server); + if($o_queue->is_error()){ + msg_dialog::display(_("Error"), $o_queue->get_error(), ERROR_DIALOG); + } + return($data); + } + + + /*! \brief Imports the given key into a keyring specified by server + @param String The mac address of the server that provides the keyring. + @param String The Key to import. + @return Boolean TRUE in case of success else FALSE. + */ + public static function import_key($server,$key) + { + $o_queue = new gosaSupportDaemon(); + $o_queue->DAK_import_key($server,$key); + if($o_queue->is_error()){ + msg_dialog::display(_("Error"), $o_queue->get_error(), ERROR_DIALOG); + return(FALSE); + } + return(TRUE); + } + + + /*! \brief Removes the given key from a keyring. + @param String The servers mac address where the keyring is located. + @param String The Key UID to remove. + @return Boolean TRUE in case of success else FALSE. + */ + public static function remove_key($server,$key) + { + $o_queue = new gosaSupportDaemon(); + $o_queue->DAK_remove_key($server,$key); + if($o_queue->is_error()){ + msg_dialog::display(_("Error"), $o_queue->get_error(), ERROR_DIALOG); + return(FALSE); + } + return(TRUE); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/dak/addons/dak/class_dak_keyring.inc b/gosa-plugins/dak/addons/dak/class_dak_keyring.inc index 40285ec55..b400a5f26 100644 --- a/gosa-plugins/dak/addons/dak/class_dak_keyring.inc +++ b/gosa-plugins/dak/addons/dak/class_dak_keyring.inc @@ -57,7 +57,7 @@ class dak_keyring extends plugin private function refresh_list() { - $this->list = DAK::get_queue_entries_for_servers($this->Servers[$this->selected_Server]['MAC']); + $this->list = DAK::list_keys($this->Servers[$this->selected_Server]['MAC']); } private function CreateList() diff --git a/gosa-plugins/dak/addons/dak/class_dak_queue.inc b/gosa-plugins/dak/addons/dak/class_dak_queue.inc index bab1007d0..ff4a55fda 100644 --- a/gosa-plugins/dak/addons/dak/class_dak_queue.inc +++ b/gosa-plugins/dak/addons/dak/class_dak_queue.inc @@ -28,7 +28,6 @@ class dak_queue extends plugin public function __construct($config) { plugin::plugin($config,NULL); - } public function execute() diff --git a/gosa-plugins/dak/addons/dak/dak_keyring.tpl b/gosa-plugins/dak/addons/dak/dak_keyring.tpl new file mode 100644 index 000000000..6f9873eaa --- /dev/null +++ b/gosa-plugins/dak/addons/dak/dak_keyring.tpl @@ -0,0 +1,33 @@ +
+

[F]{t}Filter{/t}

+
+
+ + + + + + +
+ +   + + + + + + +
+
+ +
+
+
+{$list} +
+
diff --git a/gosa-plugins/dak/addons/dak/dak_queue.tpl b/gosa-plugins/dak/addons/dak/dak_queue.tpl new file mode 100644 index 000000000..3ec7afba1 --- /dev/null +++ b/gosa-plugins/dak/addons/dak/dak_queue.tpl @@ -0,0 +1,20 @@ +
+

[F]{t}Filter{/t}

+
+
+ + + + + +
+ +   + + +
-- 2.30.2