From 6d9be9f985fa9d5c6f80d2adc76b49b53431e0a2 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 15 Sep 2010 13:49:52 +0000 Subject: [PATCH] Updated registered device plugin git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19689 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/devices/class_registeredDevice.inc | 30 ++++++++++++++++++- .../systems/goto/devices/registeredDevice.tpl | 22 +++++++------- .../goto/devices/registeredDeviceTab.inc | 28 ++++++++++++++++- 3 files changed, 67 insertions(+), 13 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/devices/class_registeredDevice.inc b/gosa-plugins/goto/admin/systems/goto/devices/class_registeredDevice.inc index c947f5b5e..52d1bcc97 100644 --- a/gosa-plugins/goto/admin/systems/goto/devices/class_registeredDevice.inc +++ b/gosa-plugins/goto/admin/systems/goto/devices/class_registeredDevice.inc @@ -8,6 +8,28 @@ class registeredDevice extends plugin public $attributes = array("cn","serialNumber","seeAlso","owner","ou","o", "l","description","manager","deviceUUID","deviceStatus"); + public $cn = ""; + public $serialNumber = ""; + public $seeAlso = ""; + public $owner = ""; + public $ou = ""; + public $o = ""; + public $l = ""; + public $description = ""; + public $manager = ""; + public $deviceUUID = ""; + public $deviceStatus = ""; + + public $base = ""; + public $orig_dn =""; + + function __construct(&$config, $dn) + { + plugin::plugin($config, $dn); + $this->base = $this->config->current['BASE']; + $this->orig_dn = $this->dn; + } + function execute() { plugin::execute(); @@ -26,7 +48,13 @@ class registeredDevice extends plugin $ldap=$this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); $ldap->cd($this->dn); - $ldap->modify($this->attrs); + + if($this->initially_was_account){ + $ldap->modify($this->attrs); + }else{ + $ldap->add($this->attrs); + } + echo $ldap->get_error(); } diff --git a/gosa-plugins/goto/admin/systems/goto/devices/registeredDevice.tpl b/gosa-plugins/goto/admin/systems/goto/devices/registeredDevice.tpl index af1561f46..6ab332f4b 100644 --- a/gosa-plugins/goto/admin/systems/goto/devices/registeredDevice.tpl +++ b/gosa-plugins/goto/admin/systems/goto/devices/registeredDevice.tpl @@ -1,13 +1,13 @@

{t}Registered device{/t}

-
-
-
-
-
-
-
-
-
-
-
+
Name: +
Serial number +
See also +
Owner +
Organizational unit +
Organization +
Location +
Description +
Manager +
UUid +
Status diff --git a/gosa-plugins/goto/admin/systems/goto/devices/registeredDeviceTab.inc b/gosa-plugins/goto/admin/systems/goto/devices/registeredDeviceTab.inc index 14e8fc483..fa902b0dd 100644 --- a/gosa-plugins/goto/admin/systems/goto/devices/registeredDeviceTab.inc +++ b/gosa-plugins/goto/admin/systems/goto/devices/registeredDeviceTab.inc @@ -2,7 +2,33 @@ class registeredDeviceTab extends tabs { -} + + + function save($ignore_account= FALSE) + { + // Prepare object DN + $baseobject= $this->by_object['registeredDevice']; + $cn = preg_replace('/,/', '\,', $baseobject->cn); + $cn = preg_replace('/"/', '\"', $cn); + $this->dn= "cn=".$cn.",ou=systems,".$baseobject->base; + $baseobject->dn= $this->dn; + + // Object moved? + if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){ + $baseobject->update_acls($baseobject->orig_dn,$this->dn); + $baseobject->move($baseobject->orig_dn,$this->dn); + } + + // Populate values + foreach ($this->by_object as $key => $obj){ + $this->by_object[$key]->dn= $this->dn; + $this->by_object[$key]->cn= $baseobject->cn; + } + + // Save now + tabs::save(TRUE); + } +} ?> -- 2.30.2