summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 847e43a)
raw | patch | inline | side by side (parent: 847e43a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 22 Oct 2007 06:33:21 +0000 (06:33 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 22 Oct 2007 06:33:21 +0000 (06:33 +0000) |
Not working
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7610 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7610 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/ArpNewDevice.tpl | [new file with mode: 0644] | patch | blob |
plugins/admin/systems/class_ArpNewDevice.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/systems/class_divListSystem.inc | patch | blob | history | |
plugins/admin/systems/class_servDNS.inc | patch | blob | history | |
plugins/admin/systems/class_systemManagement.inc | patch | blob | history | |
plugins/admin/systems/class_termDNS.inc | patch | blob | history | |
plugins/admin/systems/tabs_arpnewdevice.inc | [new file with mode: 0644] | patch | blob |
diff --git a/plugins/admin/systems/ArpNewDevice.tpl b/plugins/admin/systems/ArpNewDevice.tpl
--- /dev/null
@@ -0,0 +1,31 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Integrating unknown devices{/t}</h2>
+<p>
+ {t}The current device has been detected by the ARP monitor used by GOsa. You can integrate this device into your running DHCP/DNS infrastructure by submitting this form. The device entry will disapear from the list of the systems and move to the DNS/DHCP configuration.{/t}
+</p>
+<table summary="" style="width:100%">
+<tr>
+ <td style>
+ <LABEL for="cn">
+ {t}DNS name{/t}{$must}
+ </LABEL>
+ </td>
+ <td style='width:35%;border-right:1px solid #aaa'>
+ <input name="cn" id="cn" size=18 maxlength=60 value="{$cn}">
+ </td>
+ <td style='width:15%'>
+ <LABEL for="description">
+ {t}Description{/t}
+ </LABEL>
+ </td>
+ <td style='width:35%'>
+ <input name="description" id="description" size=18 maxlength=60 value="{$description}">
+ </td>
+</tr>
+</table>
+<br>
+<p class="seperator"></p>
+{$netconfig}
+
+<input type='hidden' name='ArpNewDevice_posted' value='1'>
+
+<p class="seperator"></p>
diff --git a/plugins/admin/systems/class_ArpNewDevice.inc b/plugins/admin/systems/class_ArpNewDevice.inc
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+class ArpNewDevice extends plugin
+{
+ var $cn= "";
+ var $description = "";
+ var $netConfigDNS = NULL;
+ var $attributes= array("cn","description");
+ var $objectclasses = array("gotoHard");
+ var $ignore_account = TRUE;
+
+ function ArpNewDevice ($config, $dn= NULL, $parent= NULL)
+ {
+ plugin :: plugin($config,$dn);
+ $this->cn ="";
+ $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
+ $this->acl = "#all#";
+ $this->netConfigDNS->acl = $this->acl;
+ $this->netConfigDNS->force_dns();
+ }
+
+ function execute()
+ {
+ $smarty = get_smarty();
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+ $this->netConfigDNS->cn= $this->cn;
+ $smarty->assign("netconfig", $this->netConfigDNS->execute());
+
+ /* Display sub dialog from network settings */
+ $this->netConfigDNS->acl = $this->acl;
+ if($this->netConfigDNS->dialog){
+ $this->dialog = TRUE;
+ return($this->netConfigDNS->execute());
+ }else{
+ $this->dialog = FALSE;
+ }
+
+ return($smarty->fetch (get_template_path('ArpNewDevice.tpl', TRUE)));
+ }
+
+ function check()
+ {
+ $message= plugin::check();
+ $message= array_merge($message, $this->netConfigDNS->check());
+ if(empty($this->cn)){
+ $message[] = _("Please specify a valid dns name.");
+ }
+ return($message);
+ }
+
+ function save_object()
+ {
+ if(isset($_POST['ArpNewDevice_posted'])){
+ plugin::save_object();
+ $this->netConfigDNS->save_object();
+ }
+ }
+
+ function save()
+ {
+ $this->netConfigDNS->acl = $this->acl;
+ plugin::save();
+ $this->netConfigDNS->cn = $this->cn;
+ $this->netConfigDNS->save($this->dn);
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->rmdir_recursive($this->dn);
+ show_ldap_error($ldap->get_error(),_("Could not remove arp-alert device after writing dns and dhcp configuration."));
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/class_divListSystem.inc b/plugins/admin/systems/class_divListSystem.inc
index 38fe1ddbf46607fdfd5126ef5687bc3eaea0b1a9..ce7c17a28e6081cdcc4f59dedbb4dc35c9af5057 100644 (file)
/* Get system type, it is used to fetch the acls for the current object.
"winstation" acls are stored as 2winworkstation", so we have to map this here */
- $type = $this->parent->get_system_type($val['objectClass']);
+ $type = $this->parent->get_system_type($val);
if($type == "winstation") {
$acl_type = "winworkstation";
}else{
}
/* Map NewDevice acls to workstation acls */
- if($type == "NewDevice"){
+ if($type == "NewDevice" || $type == "ArpNewDevice"){
$type = "incoming";
$acl_type = "incoming";
}
}
}
- $type = $this->parent->get_system_type($val['objectClass']);
+ $type = $this->parent->get_system_type($val);
+ if($type == "ArpNewDevice"){
+ $type = "NewDevice";
+ }
$cnts[$type] ++;
index 4603a4394d269565f395ec3f5c471acca3ebde55..2bc0352779ec0967934863d134a94d544431af68 100644 (file)
/* Handle Post events */
if(preg_match("/^zoneName=/",$dn)){
- $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $for));
- $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $rev));
+# $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $for));
+# $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $rev));
}
}
/* Handle Post events */
if(preg_match("/^zoneName=/",$dn)){
- $this->handle_post_events("modify",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
+# $this->handle_post_events("modify",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
}
}else{
$ldap->cd($dn);
/* Handle Post events */
if(preg_match("/^zoneName=/",$dn)){
- $this->handle_post_events("add",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
+# $this->handle_post_events("add",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
}
}
}
+ $this->handle_post_events("modify");
}
diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc
index aacc86281ec90e1581f858209bb64df3c1bd8be1..08ffae4487ceabc1b9bb563b51d4dd3dbe5b4070 100644 (file)
/* Find out more about the object type */
$ldap= $this->config->get_ldap_link();
- $ldap->cat($this->dn, array('objectClass'));
+ $ldap->cat($this->dn, array('objectClass','gotoMode'));
$attrs= $ldap->fetch();
- $type= $this->get_system_type($attrs['objectClass']);
+ $type= $this->get_system_type($attrs);
/* Lock the current entry, so everyone will get the
above dialog */
"component" => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component"));
- if($type == "NewDevice"){
+ if($type == "ArpNewDevice"){
+ $this->systab = new ArpNewDeviceTabs($this->config,$this->config->data['TABS']['ARPNEWDEVICETABS'],$this->dn);
+ }elseif($type == "NewDevice"){
$this->systab = new SelectDeviceType($this->config,$this->dn) ;
}elseif(isset($tabs[$type])){
"terminal" => array("CLASS"=>"TERMTABS", "TABNAME"=>"termgeneric", "TABCLASS" =>"termtabs", "ACL"=> "terminal"),
"workstation" => array("CLASS"=>"WORKTABS", "TABNAME"=>"workgeneric", "TABCLASS" =>"worktabs", "ACL"=> "workstation"));
- $type = $this->get_system_type($this->terminals[$s_entry]['objectClass']);
+ $type = $this->get_system_type($this->terminals[$s_entry]);
$class = $tabs[$type]["CLASS"];
$tabname = $tabs[$type]["TABNAME"];
$acl_cat = $tabs[$type]["ACL"];
$type = "";
foreach($this->terminals as $terminal){
if($terminal['dn'] == $this->dn){
- $type = $this->get_system_type($terminal['objectClass']);
+ $type = $this->get_system_type($terminal);
break;
}
}
/* Get 'dn' from posted termlinst */
$attrs = $this->terminals[$key];
- $type= $this->get_system_type($attrs['objectClass']);
+ $type= $this->get_system_type($attrs);
/* get object type */
$tabtype = "termtabs";
$this->dn = $this->terminals[$s_entry]['dn'];
$attrs = $this->terminals[$s_entry];
- $type= $this->get_system_type($attrs['objectClass']);
+ $type= $this->get_system_type($attrs);
$ui = get_userinfo();
$tabs = array(
"terminal" => array("CLASS"=>"TERMTABS", "TABCLASS" =>"termtabs", "ACL"=> "terminal/termgeneric"),
$ldap= $this->config->get_ldap_link();
$ldap->cat($this->dn, array('objectClass'));
$attrs= $ldap->fetch();
- $type= $this->get_system_type($attrs['objectClass']);
+ $type= $this->get_system_type($attrs);
$ui = get_userinfo();
}
/* Attributes to fetch */
- $sys_attrs = array("cn", "description", "macAddress", "objectClass", "sambaDomainName");
+ $sys_attrs = array("cn", "description", "macAddress", "objectClass", "sambaDomainName","gotoMode");
$sys_categories = array("terminal", "workstation", "server", "phone" ,"printer");
/* Add FAIstate to attributes if FAI is activated */
$add= "- "._("New terminal");
}elseif (in_array_ics('gotoWorkstation', $value['objectClass'])){
$add= "- "._("New workstation");
+ }elseif (in_array_ics('GOhard', $value['objectClass']) && !isset($value['gotoMode'])){
+ $add= "- "._("Unknown device");
}elseif (in_array_ics('GOhard', $value['objectClass'])){
$add= "- "._("New Device");
}
$this->CopyPasteHandler->cleanup_queue();
$dn = $this->terminals[$s_entry]['dn'];
$oc = $this->terminals[$s_entry]['objectClass'];
- $type = $this->get_system_type($oc);
+ $type = $this->get_system_type($this->terminals[$s_entry]);
$tab_o = $tabs[$type]['CLASS'];
$tab_c = $tabs[$type]['TABCLASS'];
foreach($this->list_get_selected_items() as $id){
$dn = $this->terminals[$id]['dn'];
$oc = $this->terminals[$id]['objectClass'];
- $type = $this->get_system_type($oc);
+ $type = $this->get_system_type($this->terminals[$id]);
$tab_o = $tabs[$type]['CLASS'];
$tab_c = $tabs[$type]['TABCLASS'];
}
- function get_system_type($classes)
+ function get_system_type($attrs)
{
+ #$enable_arp_device_handling = preg_match("/ArpNewDevice/i",search_config($this->config->data['TABS'], "ArpNewDevice", "CLASS"));
+ $enable_arp_device_handling = TRUE;
+ $classes = $attrs['objectClass'];
+
$type= "";
if (in_array_ics('ieee802Device', $classes)){
$type= "component";
$type= "phone";
}elseif (in_array_ics('goServer', $classes)){
$type= "server";
+ }elseif (in_array_ics('GOhard', $classes) && !isset($attrs['gotoMode']) && $enable_arp_device_handling){
+ $type= "ArpNewDevice";
}elseif (in_array_ics('GOhard', $classes)){
$type= "NewDevice";
}elseif (in_array_ics('sambaAccount', $classes) ||
index 944ebc2bf877b446118b5691a117624472eaf7f0..af07e450b4f42bc5d11126ab7d035f13be396dc9 100644 (file)
$message= plugin::check();
if($this->dhcpEnabled && $this->dhcp_is_Account && $this->dhcpParentNode != "" && count($this->dhcpHostEntry) == 0){
- $message[] =_("You have not configured your dhcp settings yet.");
+# $message[] =_("You have not configured your dhcp settings yet.");
}
/* Check if mac and ip are already used */
/* New entry */
if($this->dhcpEnabled){
+ if(count($this->dhcpHostEntry) == 0){
+ $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
+ $this->dialog->cn = $this->cn;
+ $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
+ if(!empty($this->ipHostNumber)){
+ $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
+ }
+ $this->dialog->execute();
+ $this->dialog->save_object();
+ $this->dhcpHostEntry = $this->dialog->save();
+ if(count($this->dhcpHostEntry['dhcpOption']) == 0){
+ $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
+ }
+ }
+
/* Write mac address to dhcp settings */
if($this->dhcp_is_Account){
if(!isset($this->dhcpHostEntry['dhcpHWAddress'][0]) ||
if($this->initial_dhcp_is_Account && !$this->dhcp_is_Account){
$ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
show_ldap_error($ldap->get_error(),_("Removing dhcp entry for this object failed."));
+
+ $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+ $tmp->handle_post_events("remove");
}
/* DHCP Added */
unset($attrs['dn']);
$ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
$res = $ldap->add($attrs);
+
+ $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+ $tmp->handle_post_events("add");
+
# print_a($attrs);
# print("cn=".$this->cn.",".$this->dhcpParentNode);
show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
unset($attrs['MODIFIED']);
$ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
$res = $ldap->add($attrs);
+
+ $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+ $tmp->handle_post_events("modify");
+
show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
if($res){
$ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
unset($attrs['MODIFIED']);
$ldap->cd($this->dhcpHostEntry['dn']);
$ldap->modify($attrs);
+
+ $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+ $tmp->handle_post_events("modify");
+
show_ldap_error($ldap->get_error(),_("Modifying dhcp entry failed."));
}
}
+
+ /* Handle post event */
+ $tmp = new servdns($this->config,$this->dn);
+ $tmp->handle_post_events("modify");
}
diff --git a/plugins/admin/systems/tabs_arpnewdevice.inc b/plugins/admin/systems/tabs_arpnewdevice.inc
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+class ArpNewDeviceTabs extends tabs
+{
+
+ function save()
+ {
+ tabs::save(TRUE);
+ }
+
+ function execute()
+ {
+ tabs::execute();
+ return($this->by_object[$this->current]->execute());
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>