From 0a20315529fe35cb63fae7a2ef40e2a2f0d313f8 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 15 Oct 2010 12:37:23 +0000 Subject: [PATCH] Updated install device handling -Allow to save and remove the install device extension git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20061 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/goto/Device/DeviceTab.inc | 2 +- .../goto/Device/class_InstallRecipe.inc | 73 ++++++++++++++++++- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc b/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc index 0152524a3..e713dae40 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc @@ -51,7 +51,7 @@ class DeviceTab extends tabs } // Save now - tabs::save(TRUE); + tabs::save(); if($moveToUUID){ $this->dn = (empty($uuid)) ? $dnCn : $dnUuid; diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc index 5bd3d58a7..e2c1664a1 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc @@ -39,6 +39,10 @@ class InstallRecipe extends plugin public $setKickstartRootPasswordHash = FALSE; + public $view_logged = FALSE; + + public $ignore_account = FALSE; + private $installNTPServerList = NULL; function __construct(&$config, $dn) @@ -120,6 +124,42 @@ class InstallRecipe extends plugin function execute() { + // Log account access + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","Device/".get_class($this),$this->dn); + } + + /*************** + Handle account state + ***************/ + + // Allow to add or remove the distribution list extension + if(isset($_POST['modify_state'])){ + if($this->is_account && $this->acl_is_removeable()){ + $this->is_account= FALSE; + }elseif(!$this->is_account && $this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + + // Show account status-changer + $display = ""; + if ($this->parent !== NULL){ + if ($this->is_account){ + $display= $this->show_disable_header(_("Remove instal profile"), + msgPool::featuresEnabled(_("Install profile"))); + } else { + $display= $this->show_enable_header(_("Add install profile"), + msgPool::featuresDisabled(_("Install profile"))); + return ($display); + } + } + + /*************** + Root password hash dialog + ***************/ + if($this->setKickstartRootPasswordHash){ $this->dialog = TRUE; $smarty = get_smarty(); @@ -128,6 +168,10 @@ class InstallRecipe extends plugin return($smarty->fetch(get_template_path('goto/Device/SetPassword.tpl', TRUE))); } + /*************** + Generate HTML content + ***************/ + $this->installNTPServerList->setAcl($this->getacl('installNTPServer')); $this->installNTPServerList->update(); @@ -151,7 +195,7 @@ class InstallRecipe extends plugin $smarty->assign($attr, $this->$attr); } $this->dialog = false; - return($smarty->fetch(get_template_path('goto/Device/InstallRecipe.tpl', TRUE))); + return($display.$smarty->fetch(get_template_path('goto/Device/InstallRecipe.tpl', TRUE))); } @@ -276,9 +320,12 @@ class InstallRecipe extends plugin $this->installRootEnabled = ($this->installRootEnabled)?'TRUE':'FALSE'; $this->installTimeUTC = ($this->installTimeUTC)?'TRUE':'FALSE'; - plugin::save(); + unset($this->attrs['installConfigManagement']); + unset($this->attrs['installBootstrapMethod']); + echo "Skipp saving of 'installConfigManagement' and 'installBootstrapMethod', i've no idea where to store them."; + $this->cleanup(); $ldap=$this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); @@ -292,6 +339,28 @@ class InstallRecipe extends plugin } } + + function remove_from_parent() + { + plugin::remove_from_parent(); + unset($this->attrs['installConfigManagement']); + unset($this->attrs['installBootstrapMethod']); + echo "Skipp saving of 'installConfigManagement' and 'installBootstrapMethod', i've no idea where to store them."; + + $ldap=$this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + new log("remove","Device/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); + }else{ + $this->handle_post_events("remove"); + } + + } + + static function plInfo() { return (array( -- 2.30.2