Code

Applied patches
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 May 2009 06:06:17 +0000 (06:06 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 May 2009 06:06:17 +0000 (06:06 +0000)
- 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

trunk/gosa-plugins/fai/admin/fai/class_FAI.inc
trunk/gosa-plugins/fai/admin/fai/class_faiHook.inc
trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc
trunk/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc
trunk/gosa-plugins/fai/admin/fai/class_faiScript.inc
trunk/gosa-plugins/fai/admin/fai/class_faiTemplate.inc
trunk/gosa-plugins/fai/admin/fai/class_faiVariable.inc

index fd58da5b07fd25f17917bd75ff504a8706fa1d89..3366d0307d7a1aea7ce8c7c65f8c8264ac5bba3c 100644 (file)
@@ -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();                           
+    }                                                         
+  }                                                           
+
+
 }
 
 
index e71fc1b855f504c9007428c6ab98c1a7d3a75b1e..3fdd7070f291a1832b6c2627df639c7921ea5fcd 100644 (file)
@@ -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);
index 4380ba3c7a10ec1bc44349d5393c21e9e5cf1f76..d33d148077eb164bc84403c58d80786e85b5ef57 100644 (file)
@@ -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"))){
 
index c8b0cdc1439f56f376be3c1fd7706b26773e2ae7..bd43bd7691ef0cd824eea945f3eb4240b9b83d81 100644 (file)
@@ -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);
index dc8359d929496a39098201dc74fc53dd58cdebf7..a604bd4b0ddd0b16a8205bb592f62e88850851e7 100644 (file)
@@ -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);
index 5e60e4f80637dd160e17a549b9fe593fac43ad55..b1d0af684d2682489b0fa5afb60183f931061184 100644 (file)
@@ -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);
index 0847d8842c3584d039447498b6a37c63d011f938..c8d3f21aababfca7e52b1e69dfa79aa53939760d 100644 (file)
@@ -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);