From: hickert Date: Thu, 17 Sep 2009 15:24:22 +0000 (+0000) Subject: Added the ability the set dns for opsi hosts. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9ecaff6a9b5a9b2759304384eaa58354adcb477a;p=gosa.git Added the ability the set dns for opsi hosts. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14282 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc index 911507fac..6aec6c21a 100644 --- a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc +++ b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc @@ -45,6 +45,7 @@ class opsiGeneric extends plugin public $attributes = array("mac","note","description"); + public $netConfigDNS = NULL; /*! \brief Initialize this class @param Object The GOsa base config. @@ -75,9 +76,34 @@ class opsiGeneric extends plugin $this->hostId = preg_replace('/\$$/',"",$this->hostId); } } - + /* Try to plugin */ $this->init(); + + // Now fake a valid ldap entry ... this is necessary to avoid + // modifications in the dns/dhcp classes + + // First fake cn + $this->attrs['hostId'][0] = $this->hostId; + $this->attrs['cn'][0] = $this->hostId; + + // Second detect DNS settings. + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $strippedHostId = preg_replace("/\..*$/","",$this->hostId); + $ldap->search("(&(objectClass=dNSZone)(|(relativeDomainName=".$this->hostId.")(relativeDomainName=".$strippedHostId."))(aRecord=*))",array("aRecord")); + if($ldap->count()){ + $attrs = $ldap->fetch(); + $this->attrs['ipHostNumber']['count'] = 0; + $this->attrs['ipHostNumber'][0] = $attrs['aRecord'][0]; + } + + // Initialize DHCP and DNS + $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, FALSE, "hostId"); + $this->netConfigDNS->set_acl_category("opsi"); + $this->netConfigDNS->set_acl_base($this->config->current['BASE']); + $this->netConfigDNS->IPisMust = FALSE; + $this->netConfigDNS->MACisMust = FALSE; } @@ -206,6 +232,7 @@ class opsiGeneric extends plugin public function check() { $messages = plugin::check(); + $messages= array_merge($messages, $this->netConfigDNS->check()); if(empty($this->hostId)){ $messages[] = msgPool::required(_("Name")); @@ -352,6 +379,13 @@ class opsiGeneric extends plugin $cfg_able &= $this->acl_is_readable("netbootProduct"); } + // Get net config template + $str = $this->netConfigDNS->execute(); + if(is_object($this->netConfigDNS->dialog)){ + return($str); + } + $smarty->assign("netconfig", $str); + $smarty->assign("netboot_configurable",$cfg_able); $smarty->assign("hostId", $this->hostId); $smarty->assign("divSLP", $divSLP->DrawList()); @@ -501,6 +535,9 @@ class opsiGeneric extends plugin return; } } + + $this->netConfigDNS->cn = $this->hostId; + $this->netConfigDNS->save(); } @@ -527,6 +564,8 @@ class opsiGeneric extends plugin */ public function remove_from_parent() { + $this->netConfigDNS->remove_from_parent(); + $this->opsi->del_client($this->hostId); if($this->opsi->is_error()){ msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG); @@ -577,6 +616,7 @@ class opsiGeneric extends plugin if(isset($_POST['opsiGeneric_posted'])){ plugin::save_object(); + $this->netConfigDNS->save_object(); /* Get hostId */ diff --git a/gosa-plugins/opsi/admin/opsi/generic.tpl b/gosa-plugins/opsi/admin/opsi/generic.tpl index 139b4e2e0..1a40e95ad 100644 --- a/gosa-plugins/opsi/admin/opsi/generic.tpl +++ b/gosa-plugins/opsi/admin/opsi/generic.tpl @@ -130,5 +130,9 @@ +

 

+ +{$netconfig} + {/if}