From 24fb3d4c6f889fcbf2fb52c02670c45494aeeb95 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 7 May 2009 06:06:17 +0000 Subject: [PATCH] Applied patches - 12995 - 12994 - 12993 - 12991 The above commits modified the unit tagging for fai objects. Objects will now be tagged with the unit tag of the editing user. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13622 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gosa-plugins/fai/admin/fai/class_FAI.inc | 30 +++++++++++++++++++ .../fai/admin/fai/class_faiHook.inc | 3 +- .../fai/admin/fai/class_faiPackage.inc | 3 +- .../fai/admin/fai/class_faiPartitionTable.inc | 6 ++-- .../fai/admin/fai/class_faiScript.inc | 3 +- .../fai/admin/fai/class_faiTemplate.inc | 3 +- .../fai/admin/fai/class_faiVariable.inc | 3 +- 7 files changed, 44 insertions(+), 7 deletions(-) diff --git a/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc b/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc index fd58da5b0..3366d0307 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc @@ -640,6 +640,9 @@ class FAI $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $dn)); $ldap->cd($dn); + $ui= get_userinfo(); + FAI::tag_attrs($attrs, $dn, $ui->gosaUnitTag); + $ldap->cat($dn,array("dn")); if($ldap->count()){ @@ -1233,6 +1236,33 @@ class FAI } return(""); } + + + static function tag_attrs(&$at, $dn= "", $tag= "", $show= false) + { + /* Remove tags that may already be here... */ + remove_objectClass("gosaAdministrativeUnitTag", $at); + if (isset($at['gosaUnitTag'])){ + unset($at['gosaUnitTag']); + } + + /* Set tag? */ + if ($tag != ""){ + add_objectClass("gosaAdministrativeUnitTag", $at); + $at['gosaUnitTag']= $tag; + } + + /* Initially this object was tagged. + - But now, it is no longer inside a tagged department. + So force the remove of the tag. + (objectClass was already removed obove) + */ + if($tag == ""){ + $at['gosaUnitTag'] = array(); + } + } + + } diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiHook.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiHook.inc index e71fc1b85..3fdd7070f 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_faiHook.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_faiHook.inc @@ -508,7 +508,8 @@ class faiHook extends plugin } /* Tag object */ - $this->tag_attrs($tmp, $sub_dn, $this->gosaUnitTag); + $ui= get_userinfo(); + $this->tag_attrs($tmp, $sub_dn, $ui->gosaUnitTag); if($obj['status'] == "delete"){ FAI::prepare_to_save_FAI_object($sub_dn,array(),true); diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc index 4380ba3c7..d33d14807 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc @@ -549,7 +549,8 @@ class faiPackage extends plugin $pkgdn = "FAIvariable=".$name.",".$this->dn; /* Tag object */ - $this->tag_attrs($pkgattrs, $pkgdn, $this->gosaUnitTag); + $ui= get_userinfo(); + $this->tag_attrs($pkgattrs, $pkgdn, $ui->gosaUnitTag); if(in_array($pkgattrs['FAIvariableType'],array("boolean","multiselect","password","select","string","text"))){ diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc index c8b0cdc14..bd43bd769 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc @@ -429,7 +429,8 @@ class faiPartitionTable extends plugin } /* Tag object */ - $this->tag_attrs($disk_attrs, $disk_dn, $this->gosaUnitTag); + $ui= get_userinfo(); + $this->tag_attrs($disk_attrs, $disk_dn, $ui->gosaUnitTag); if($disk['status'] == "delete"){ FAI::prepare_to_save_FAI_object($disk_dn,array(),true); @@ -474,7 +475,8 @@ class faiPartitionTable extends plugin } /* Tag object */ - $this->tag_attrs($partition_attrs, $partition_dn, $this->gosaUnitTag); + $ui= get_userinfo(); + $this->tag_attrs($partition_attrs, $partition_dn, $ui->gosaUnitTag); if($partition['status'] == "delete"){ FAI::prepare_to_save_FAI_object($partition_dn,array(),true); diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiScript.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiScript.inc index dc8359d92..a604bd4b0 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_faiScript.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_faiScript.inc @@ -564,7 +564,8 @@ class faiScript extends plugin } /* Tag object */ - $this->tag_attrs($tmp, $sub_dn, $this->gosaUnitTag); + $ui= get_userinfo(); + $this->tag_attrs($tmp, $sub_dn, $ui->gosaUnitTag); if($obj['status'] == "delete"){ FAI::prepare_to_save_FAI_object($sub_dn,array(),true); diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiTemplate.inc index 5e60e4f80..b1d0af684 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_faiTemplate.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_faiTemplate.inc @@ -491,7 +491,8 @@ class faiTemplate extends plugin } /* Tag object */ - $this->tag_attrs($tmp, $sub_dn, $this->gosaUnitTag); + $ui= get_userinfo(); + $this->tag_attrs($tmp, $sub_dn, $ui->gosaUnitTag); if($obj['status'] == "delete"){ FAI::prepare_to_save_FAI_object($sub_dn,array(),true); diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiVariable.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiVariable.inc index 0847d8842..c8d3f21aa 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_faiVariable.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_faiVariable.inc @@ -347,7 +347,8 @@ class faiVariable extends plugin } /* Tag object */ - $this->tag_attrs($tmp, $sub_dn, $this->gosaUnitTag); + $ui= get_userinfo(); + $this->tag_attrs($tmp, $sub_dn, $ui->gosaUnitTag); if($obj['status'] == "delete"){ FAI::prepare_to_save_FAI_object($sub_dn,array(),true); -- 2.30.2