From deaa2d33db2c0edbbc06443a7a7d9e89328b9f7c Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 10 Dec 2007 09:20:58 +0000 Subject: [PATCH] Udpated Tag handling for FAI objects. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@8064 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_CopyPasteHandler.inc | 14 ++++++++++++++ plugins/admin/fai/class_faiHook.inc | 2 +- plugins/admin/fai/class_faiPackage.inc | 2 +- plugins/admin/fai/class_faiPartitionTable.inc | 2 +- plugins/admin/fai/class_faiProfile.inc | 2 +- plugins/admin/fai/class_faiScript.inc | 2 +- plugins/admin/fai/class_faiTemplate.inc | 2 +- plugins/admin/fai/class_faiVariable.inc | 2 +- 8 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index aba5e3208..e09e6926b 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -67,6 +67,20 @@ class CopyPasteHandler { } } } + + /* Ensure that UnitTags will be kept when pasted */ + if(isset($obj->gosaUnitTag) && !empty($obj->gosaUnitTag)){ + foreach($this->current->by_object as $name => $obj){ + if(!in_array("gosaAdministrativeUnitTag",$this->current->by_object[$name]->objectclasses)){ + $this->current->by_object[$name]->objectclasses[] = "gosaAdministrativeUnitTag"; + $this->current->by_object[$name]->gosaUnitTag = $obj->gosaUnitTag; + if(!in_array("gosaUnitTag",$this->current->by_object[$name]->attributes)){ + $this->current->by_object[$name]->attributes[] = "gosaUnitTag"; + } + } + } + } + if($this->isCurrentObjectPastAble()){ return(true); }else{ diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index 0ad7dba9e..3c56f2cdb 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -433,7 +433,7 @@ class faiHook extends plugin show_ldap_error($ldap->get_error(), _("Saving FAI hook base failed")); /* Do object tagging */ - $this->handle_object_tagging(); + $this->handle_object_tagging($this->dn,$this->gosaUnitTag); $ldap->cd($this->dn); diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index 32a26f91b..36ad4e38e 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -508,7 +508,7 @@ class faiPackage extends plugin show_ldap_error($ldap->get_error(), _("Saving FAI package base failed")); /* Do object tagging */ - $this->handle_object_tagging(); + $this->handle_object_tagging($this->dn,$this->gosaUnitTag); $ldap->cd($this->dn); /* Save Package configurations */ diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc index c85cf9ab3..dfcc7a0e8 100644 --- a/plugins/admin/fai/class_faiPartitionTable.inc +++ b/plugins/admin/fai/class_faiPartitionTable.inc @@ -368,7 +368,7 @@ class faiPartitionTable extends plugin show_ldap_error($ldap->get_error(), _("Saving FAI partition table base failed")); /* Do object tagging */ - $this->handle_object_tagging(); + $this->handle_object_tagging($this->dn,$this->gosaUnitTag); /* Sort entries, because we must delete entries with status="delete" first */ $order = array(); diff --git a/plugins/admin/fai/class_faiProfile.inc b/plugins/admin/fai/class_faiProfile.inc index 84e5b40b1..62c13adf9 100644 --- a/plugins/admin/fai/class_faiProfile.inc +++ b/plugins/admin/fai/class_faiProfile.inc @@ -459,7 +459,7 @@ class faiProfile extends plugin show_ldap_error($ldap->get_error(), _("Saving FAI profile failed")); /* Do object tagging */ - $this->handle_object_tagging(); + $this->handle_object_tagging($this->dn,$this->gosaUnitTag); show_ldap_error($ldap->get_error()); } diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index ac945d890..5bfe27019 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -465,7 +465,7 @@ class faiScript extends plugin show_ldap_error($ldap->get_error(), _("Creating FAI script base failed")); /* Do object tagging */ - $this->handle_object_tagging(); + $this->handle_object_tagging($this->dn, $this->gosaUnitTag); /* Prepare FAIscriptEntry to write it to ldap * First sort array. diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index bb552443c..b04e07fc1 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -403,7 +403,7 @@ class faiTemplate extends plugin show_ldap_error($ldap->get_error(), _("Saving FAI template base failed")); /* Do object tagging */ - $this->handle_object_tagging(); + $this->handle_object_tagging($this->dn,$this->gosaUnitTag); /* Prepare FAIscriptEntry to write it to ldap * First sort array. diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index 171ad312d..19622f165 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -315,7 +315,7 @@ class faiVariable extends plugin show_ldap_error($ldap->get_error(), _("Saving FAI variable base failed")); /* Do object tagging */ - $this->handle_object_tagging(); + $this->handle_object_tagging($this->dn,$this->gosaUnitTag); /* Prepare FAIscriptEntry to write it to ldap * First sort array. -- 2.30.2