From 16a4e977a2e92a5e07bb35fc880931904f587872 Mon Sep 17 00:00:00 2001 From: cajus Date: Tue, 15 Jan 2008 16:55:25 +0000 Subject: [PATCH] Updated tagging git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8372 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_plugin.inc | 77 +------ gosa-core/plugins/admin/acl/tabs_acl_role.inc | 4 - .../admin/applications/tabs_application.inc | 4 - .../departments/class_departmentGeneric.inc | 202 +++++++++++++----- .../plugins/admin/devices/tabs_devices.inc | 5 - gosa-core/plugins/admin/fai/class_faiHook.inc | 16 +- .../plugins/admin/fai/class_faiPackage.inc | 15 +- .../admin/fai/class_faiPartitionTable.inc | 23 +- .../plugins/admin/fai/class_faiProfile.inc | 4 - .../plugins/admin/fai/class_faiScript.inc | 17 +- .../plugins/admin/fai/class_faiTemplate.inc | 17 +- .../plugins/admin/fai/class_faiVariable.inc | 16 +- gosa-core/plugins/admin/groups/tabs_group.inc | 4 - .../admin/mimetypes/tabs_mimetypes.inc | 5 - .../plugins/admin/ogroups/tabs_ogroups.inc | 4 - .../admin/systems/class_printGeneric.inc | 3 - .../plugins/admin/systems/tabs_component.inc | 3 - .../plugins/admin/systems/tabs_phone.inc | 3 - .../plugins/admin/systems/tabs_printers.inc | 3 - .../plugins/admin/systems/tabs_server.inc | 3 - .../plugins/admin/systems/tabs_terminal.inc | 3 - .../plugins/admin/systems/tabs_winstation.inc | 3 - .../admin/systems/tabs_workstation.inc | 3 - .../plugins/personal/generic/class_user.inc | 3 - 24 files changed, 176 insertions(+), 264 deletions(-) diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 29e884040..346699bad 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -364,6 +364,8 @@ class plugin } } + /* Handle tagging */ + $this->tag_attrs(&$this->attrs); } @@ -987,13 +989,8 @@ class plugin } } - - function handle_object_tagging($dn= "", $tag= "", $show= false) + function tag_attrs($at, $dn= "", $tag= "", $show= false) { - //FIXME: How to optimize this? We have at least two - // LDAP accesses per object. It would be a good - // idea to have it integrated. - /* No dn? Self-operation... */ if ($dn == ""){ $dn= $this->dn; @@ -1031,71 +1028,17 @@ class plugin } } + /* Remove tags that may already be here... */ + remove_objectClass("gosaAdministrativeUnitTag", &$at); + if (isset($at['gosaUnitTag'])){ + unset($at['gosaUnitTag']); + } /* Set tag? */ if ($tag != ""){ - /* Set objectclass and attribute */ - $ldap= $this->config->get_ldap_link(); - $ldap->cat($dn, array('gosaUnitTag', 'objectClass')); - $attrs= $ldap->fetch(); - if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){ - if ($show) { - echo sprintf(_("Object '%s' is already tagged"), @LDAP::fix($dn))."
"; - flush(); - } - return; - } - if (count($attrs)){ - if ($show){ - echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."
"; - flush(); - } - $nattrs= array("gosaUnitTag" => $tag); - $nattrs['objectClass']= array(); - for ($i= 0; $i<$attrs['objectClass']['count']; $i++){ - $oc= $attrs['objectClass'][$i]; - if ($oc != "gosaAdministrativeUnitTag"){ - $nattrs['objectClass'][]= $oc; - } - } - $nattrs['objectClass'][]= "gosaAdministrativeUnitTag"; - $ldap->cd($dn); - $ldap->modify($nattrs); - show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn)); - } else { - @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not tagging ($tag) $dn - seems to have moved away", "Tagging"); - } - - } else { - /* Remove objectclass and attribute */ - $ldap= $this->config->get_ldap_link(); - $ldap->cat($dn, array('gosaUnitTag', 'objectClass')); - $attrs= $ldap->fetch(); - if (isset($attrs['objectClass']) && !in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])){ - @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "$dn is not tagged", "Tagging"); - return; - } - if (count($attrs)){ - if ($show){ - echo sprintf(_("Removing tag from object '%s'"), @LDAP::fix($dn))."
"; - flush(); - } - $nattrs= array("gosaUnitTag" => array()); - $nattrs['objectClass']= array(); - for ($i= 0; $i<$attrs['objectClass']['count']; $i++){ - $oc= $attrs['objectClass'][$i]; - if ($oc != "gosaAdministrativeUnitTag"){ - $nattrs['objectClass'][]= $oc; - } - } - $ldap->cd($dn); - $ldap->modify($nattrs); - show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn)); - } else { - @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging"); - } + add_objectClass("gosaAdministrativeUnitTag", &$at); + $at['gosaUnitTag']= $tag; } - } diff --git a/gosa-core/plugins/admin/acl/tabs_acl_role.inc b/gosa-core/plugins/admin/acl/tabs_acl_role.inc index 3c119d164..1d8c006b1 100644 --- a/gosa-core/plugins/admin/acl/tabs_acl_role.inc +++ b/gosa-core/plugins/admin/acl/tabs_acl_role.inc @@ -31,10 +31,6 @@ class aclroletab extends tabs $ret= tabs::save(); - /* Fix tagging if needed */ - $baseobject->dn= $new_dn; - $baseobject->handle_object_tagging(); - return $ret; } diff --git a/gosa-core/plugins/admin/applications/tabs_application.inc b/gosa-core/plugins/admin/applications/tabs_application.inc index 23d2f39ad..5b6e82989 100644 --- a/gosa-core/plugins/admin/applications/tabs_application.inc +++ b/gosa-core/plugins/admin/applications/tabs_application.inc @@ -52,10 +52,6 @@ class apptabs extends tabs } tabs::save(); - - /* Fix tagging if needed */ - $baseobject->dn= $this->dn; - $baseobject->handle_object_tagging(); } } diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc index e1d637d15..03cedf2dc 100644 --- a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc @@ -380,11 +380,6 @@ class department extends plugin /* The parameter forces only to set must_be_tagged, and don't touch any objects This will be done later */ $this->tag_objects(true); - - /* Fix tagging if needed */ - if (!$this->is_administrational_unit){ - $this->handle_object_tagging(); - } } /* Optionally execute a command after we're done */ @@ -429,53 +424,53 @@ class department extends plugin echo "

".sprintf(_("Tagging '%s'."),"".@LDAP::fix($this->dn)."")."

"; } - $add= $this->is_administrational_unit; - $len= strlen($this->dn); - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - if ($add){ - $ldap->search('(!(&(objectClass=gosaAdministrativeUnitTag)(gosaUnitTag='. - $this->gosaUnitTag.')))', array('dn')); - } else { - $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn')); - } - - while ($attrs= $ldap->fetch()){ - - /* Skip self */ - if ($attrs['dn'] == $this->dn){ - continue; - } - - /* Check for confilicting administrative units */ - $fix= true; - foreach ($this->config->adepartments as $key => $tag){ - /* This one is shorter than our dn, its not relevant... */ - if ($len >= strlen($key)){ - continue; - } - - /* This one matches with the latter part. Break and don't fix this entry */ - if (preg_match('/(^|,)'.normalizePreg($key).'$/', $attrs['dn'])){ - $fix= false; - break; - } - } + $add= $this->is_administrational_unit; + $len= strlen($this->dn); + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + if ($add){ + $ldap->search('(!(&(objectClass=gosaAdministrativeUnitTag)(gosaUnitTag='. + $this->gosaUnitTag.')))', array('dn')); + } else { + $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn')); + } - /* Fix entry if needed */ - if ($fix){ - if($OnlySetTagFlag){ - $this->must_be_tagged =true; - return; - } - $this->handle_object_tagging($attrs['dn'], $this->gosaUnitTag, TRUE ); - } - } + while ($attrs= $ldap->fetch()){ + + /* Skip self */ + if ($attrs['dn'] == $this->dn){ + continue; + } + + /* Check for confilicting administrative units */ + $fix= true; + foreach ($this->config->adepartments as $key => $tag){ + /* This one is shorter than our dn, its not relevant... */ + if ($len >= strlen($key)){ + continue; + } + + /* This one matches with the latter part. Break and don't fix this entry */ + if (preg_match('/(^|,)'.normalizePreg($key).'$/', $attrs['dn'])){ + $fix= false; + break; + } + } + + /* Fix entry if needed */ + if ($fix){ + if($OnlySetTagFlag){ + $this->must_be_tagged =true; + return; + } + $this->handle_object_tagging($attrs['dn'], $this->gosaUnitTag, TRUE ); + } + } if(!$OnlySetTagFlag){ - echo '

 

'; - echo "
-
-
"; + echo '

 

'; + echo "
+
+
"; } } @@ -605,6 +600,113 @@ class department extends plugin "facsimileTelephoneNumber" => _("Fax")) )); } + + function handle_object_tagging($dn= "", $tag= "", $show= false) + { + /* No dn? Self-operation... */ + if ($dn == ""){ + $dn= $this->dn; + + /* No tag? Find it yourself... */ + if ($tag == ""){ + $len= strlen($dn); + + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "No tag for $dn - looking for one...", "Tagging"); + $relevant= array(); + foreach ($this->config->adepartments as $key => $ntag){ + + /* This one is bigger than our dn, its not relevant... */ + if ($len <= strlen($key)){ + continue; + } + + /* This one matches with the latter part. Break and don't fix this entry */ + if (preg_match('/(^|,)'.normalizePreg($key).'$/', $dn)){ + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "DEBUG: Possibly relevant: $key", "Tagging"); + $relevant[strlen($key)]= $ntag; + continue; + } + + } + + /* If we've some relevant tags to set, just get the longest one */ + if (count($relevant)){ + ksort($relevant); + $tmp= array_keys($relevant); + $idx= end($tmp); + $tag= $relevant[$idx]; + $this->gosaUnitTag= $tag; + } + } + } + + /* Set tag? */ + if ($tag != ""){ + /* Set objectclass and attribute */ + $ldap= $this->config->get_ldap_link(); + $ldap->cat($dn, array('gosaUnitTag', 'objectClass')); + $attrs= $ldap->fetch(); + if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){ + if ($show) { + echo sprintf(_("Object '%s' is already tagged"), @LDAP::fix($dn))."
"; + flush(); + } + return; + } + if (count($attrs)){ + if ($show){ + echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."
"; + flush(); + } + $nattrs= array("gosaUnitTag" => $tag); + $nattrs['objectClass']= array(); + for ($i= 0; $i<$attrs['objectClass']['count']; $i++){ + $oc= $attrs['objectClass'][$i]; + if ($oc != "gosaAdministrativeUnitTag"){ + $nattrs['objectClass'][]= $oc; + } + } + $nattrs['objectClass'][]= "gosaAdministrativeUnitTag"; + $ldap->cd($dn); + $ldap->modify($nattrs); + show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn)); + } else { + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not tagging ($tag) $dn - seems to have moved away", "Tagging"); + } + + } else { + /* Remove objectclass and attribute */ + $ldap= $this->config->get_ldap_link(); + $ldap->cat($dn, array('gosaUnitTag', 'objectClass')); + $attrs= $ldap->fetch(); + if (isset($attrs['objectClass']) && !in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])){ + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "$dn is not tagged", "Tagging"); + return; + } + if (count($attrs)){ + if ($show){ + echo sprintf(_("Removing tag from object '%s'"), @LDAP::fix($dn))."
"; + flush(); + } + $nattrs= array("gosaUnitTag" => array()); + $nattrs['objectClass']= array(); + for ($i= 0; $i<$attrs['objectClass']['count']; $i++){ + $oc= $attrs['objectClass'][$i]; + if ($oc != "gosaAdministrativeUnitTag"){ + $nattrs['objectClass'][]= $oc; + } + } + $ldap->cd($dn); + $ldap->modify($nattrs); + show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn)); + } else { + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging"); + } + } + + } + } + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-core/plugins/admin/devices/tabs_devices.inc b/gosa-core/plugins/admin/devices/tabs_devices.inc index 97316ddd2..0feddfc4e 100644 --- a/gosa-core/plugins/admin/devices/tabs_devices.inc +++ b/gosa-core/plugins/admin/devices/tabs_devices.inc @@ -31,11 +31,6 @@ class devicetabs extends tabs } tabs::save(); - - /* Fix tagging if needed */ - $baseobject->dn= $this->dn; - $baseobject->handle_object_tagging(); - $this->by_object['deviceGeneric'] = $baseobject; } } diff --git a/gosa-core/plugins/admin/fai/class_faiHook.inc b/gosa-core/plugins/admin/fai/class_faiHook.inc index f65d06d1c..fb64e5d3c 100644 --- a/gosa-core/plugins/admin/fai/class_faiHook.inc +++ b/gosa-core/plugins/admin/fai/class_faiHook.inc @@ -465,9 +465,6 @@ class faiHook extends plugin new log("create","fai/".get_class($this),$this->dn,$this->attributes); } - /* Do object tagging */ - $this->handle_object_tagging(); - $ldap->cd($this->dn); /* Prepare FAIscriptEntry to write it to ldap @@ -525,16 +522,8 @@ class faiHook extends plugin } } - /* Check if gosaAdministrativeUnitTag is required as object class */ - if($obj['status'] == "edited"){ - $ldap->cat($sub_dn,array("objectClass")); - $attrs = $ldap->fetch(); - if(isset($attrs['objectClass'])){ - if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){ - $tmp['objectClass'][] = "gosaAdministrativeUnitTag"; - } - } - } + /* Tag object */ + $this->tag_attrs(&$tmp, $sub_dn, $this->gosaUnitTag); if($obj['status'] == "delete"){ FAI::prepare_to_save_FAI_object($sub_dn,array(),true); @@ -546,7 +535,6 @@ class faiHook extends plugin FAI::prepare_to_save_FAI_object($sub_dn,$tmp); $this->handle_post_events("add"); } - $this->handle_object_tagging($sub_dn, $this->gosaUnitTag); } } diff --git a/gosa-core/plugins/admin/fai/class_faiPackage.inc b/gosa-core/plugins/admin/fai/class_faiPackage.inc index 9938e2142..6d6826222 100644 --- a/gosa-core/plugins/admin/fai/class_faiPackage.inc +++ b/gosa-core/plugins/admin/fai/class_faiPackage.inc @@ -501,8 +501,6 @@ class faiPackage extends plugin new log("create","fai/".get_class($this),$this->dn,$this->attributes); } - /* Do object tagging */ - $this->handle_object_tagging(); $ldap->cd($this->dn); /* Save Package configurations */ @@ -524,21 +522,12 @@ class faiPackage extends plugin $pkgattrs['FAIvariableContent'] = $attr['Value']; $pkgdn = "FAIvariable=".$name.",".$this->dn; - /* cehck if object already exists */ - $ldap->cat($pkgdn,array("objectClass")); - - /* Workaround for missing "gosaAdministrativeUnitTag" */ - $attrs = $ldap->fetch(); - if((isset($attrs['objectClass'])) && (in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass']))){ - $pkgattrs['objectClass'][] = "gosaAdministrativeUnitTag"; - } + /* Tag object */ + $this->tag_attrs(&$pkgattrs, $pkgdn, $this->gosaUnitTag); if(in_array($pkgattrs['FAIvariableType'],array("boolean","multiselect","password","select","string","text"))){ FAI::prepare_to_save_FAI_object($pkgdn,$pkgattrs); } - - /* Handle tagging */ - $this->handle_object_tagging($pkgdn, $this->gosaUnitTag); } } } diff --git a/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc b/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc index 1b4931ca7..99417316e 100644 --- a/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc +++ b/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc @@ -423,9 +423,6 @@ class faiPartitionTable extends plugin new log("create","fai/".get_class($this),$this->dn,$this->attributes); } - /* Do object tagging */ - $this->handle_object_tagging(); - /* Sort entries, because we must delete entries with status="delete" first */ $order = array(); foreach($this->disks as $key => $disk){ @@ -453,12 +450,8 @@ class faiPartitionTable extends plugin } } - /* Fix problem with missing objectClass "gosaAdministrativeUnitTag" for disks */ - $ldap->cat($disk_dn,array("objectClass")); - $attrs = $ldap->fetch(); - if(isset($attrs['objectClass']) && in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){ - $disk_attrs['objectClass'][] = "gosaAdministrativeUnitTag"; - } + /* Tag object */ + $this->tag_attrs(&$disk_attrs, $disk_dn, $this->gosaUnitTag); if($disk['status'] == "delete"){ FAI::prepare_to_save_FAI_object($disk_dn,array(),true); @@ -471,8 +464,6 @@ class faiPartitionTable extends plugin $this->handle_post_events("add"); } - $this->handle_object_tagging($disk_dn, $this->gosaUnitTag); - if($disk['status']!="delete") /* Add all partitions */ foreach($disk['partitions'] as $key => $partition){ @@ -504,12 +495,8 @@ class faiPartitionTable extends plugin $partition_attrs['FAImountPoint']="swap"; } - /* Fix problem with missing objectClass "gosaAdministrativeUnitTag" for partitions */ - $ldap->cat($partition_dn,array("objectClass")); - $attrs = $ldap->fetch(); - if(isset($attrs['objectClass']) && in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){ - $partition_attrs['objectClass'][] = "gosaAdministrativeUnitTag"; - } + /* Tag object */ + $this->tag_attrs(&$partition_attrs, $partition_dn, $this->gosaUnitTag); if($partition['status'] == "delete"){ FAI::prepare_to_save_FAI_object($partition_dn,array(),true); @@ -521,8 +508,6 @@ class faiPartitionTable extends plugin FAI::prepare_to_save_FAI_object($partition_dn,$partition_attrs); $this->handle_post_events("add"); } - - $this->handle_object_tagging($partition_dn, $this->gosaUnitTag); } } $this->handle_post_events("add"); diff --git a/gosa-core/plugins/admin/fai/class_faiProfile.inc b/gosa-core/plugins/admin/fai/class_faiProfile.inc index cd325b475..3eaa08b5e 100644 --- a/gosa-core/plugins/admin/fai/class_faiProfile.inc +++ b/gosa-core/plugins/admin/fai/class_faiProfile.inc @@ -449,10 +449,6 @@ class faiProfile extends plugin } show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn)); - - /* Do object tagging */ - $this->handle_object_tagging(); - show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn)); } diff --git a/gosa-core/plugins/admin/fai/class_faiScript.inc b/gosa-core/plugins/admin/fai/class_faiScript.inc index 68a58e016..2233b6ae6 100644 --- a/gosa-core/plugins/admin/fai/class_faiScript.inc +++ b/gosa-core/plugins/admin/fai/class_faiScript.inc @@ -512,9 +512,6 @@ class faiScript extends plugin new log("create","fai/".get_class($this),$this->dn,$this->attributes); } - /* Do object tagging */ - $this->handle_object_tagging(); - /* Prepare FAIscriptEntry to write it to ldap * First sort array. * Because we must delete old entries first. @@ -575,16 +572,8 @@ class faiScript extends plugin $tmp['FAIpriority'] ="0"; } - /* Check if gosaAdministrativeUnitTag is required as object class */ - if($obj['status'] == "edited"){ - $ldap->cat($sub_dn,array("objectClass")); - $attrs = $ldap->fetch(); - if(isset($attrs['objectClass'])){ - if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){ - $tmp['objectClass'][] = "gosaAdministrativeUnitTag"; - } - } - } + /* Tag object */ + $this->tag_attrs(&$tmp, $sub_dn, $this->gosaUnitTag); if($obj['status'] == "delete"){ FAI::prepare_to_save_FAI_object($sub_dn,array(),true); @@ -596,8 +585,6 @@ class faiScript extends plugin FAI::prepare_to_save_FAI_object($sub_dn,$tmp); $this->handle_post_events("add"); } - - $this->handle_object_tagging($sub_dn, $this->gosaUnitTag); } } diff --git a/gosa-core/plugins/admin/fai/class_faiTemplate.inc b/gosa-core/plugins/admin/fai/class_faiTemplate.inc index b13104b30..54bd83267 100644 --- a/gosa-core/plugins/admin/fai/class_faiTemplate.inc +++ b/gosa-core/plugins/admin/fai/class_faiTemplate.inc @@ -443,9 +443,6 @@ class faiTemplate extends plugin new log("create","fai/".get_class($this),$this->dn,$this->attributes); } - /* Do object tagging */ - $this->handle_object_tagging(); - /* Prepare FAIscriptEntry to write it to ldap * First sort array. * Because we must delete old entries first. @@ -494,16 +491,8 @@ class faiTemplate extends plugin } } - /* Check if gosaAdministrativeUnitTag is required as object class */ - if($obj['status'] == "edited"){ - $ldap->cat($sub_dn,array("objectClass")); - $attrs = $ldap->fetch(); - if(isset($attrs['objectClass'])){ - if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){ - $tmp['objectClass'][] = "gosaAdministrativeUnitTag"; - } - } - } + /* Tag object */ + $this->tag_attrs(&$tmp, $sub_dn, $this->gosaUnitTag); if($obj['status'] == "delete"){ FAI::prepare_to_save_FAI_object($sub_dn,array(),true); @@ -516,8 +505,6 @@ class faiTemplate extends plugin $this->handle_post_events("add"); } - - $this->handle_object_tagging($sub_dn, $this->gosaUnitTag); } } diff --git a/gosa-core/plugins/admin/fai/class_faiVariable.inc b/gosa-core/plugins/admin/fai/class_faiVariable.inc index 278710e72..7229e3634 100644 --- a/gosa-core/plugins/admin/fai/class_faiVariable.inc +++ b/gosa-core/plugins/admin/fai/class_faiVariable.inc @@ -345,9 +345,6 @@ class faiVariable extends plugin new log("create","fai/".get_class($this),$this->dn,$this->attributes); } - /* Do object tagging */ - $this->handle_object_tagging(); - /* Prepare FAIscriptEntry to write it to ldap * First sort array. * Because we must delete old entries first. @@ -390,16 +387,8 @@ class faiVariable extends plugin } } - /* Check if gosaAdministrativeUnitTag is required as object class */ - if($obj['status'] == "edited"){ - $ldap->cat($sub_dn,array("objectClass")); - $attrs = $ldap->fetch(); - if(isset($attrs['objectClass'])){ - if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){ - $tmp['objectClass'][] = "gosaAdministrativeUnitTag"; - } - } - } + /* Tag object */ + $this->tag_attrs(&$tmp, $sub_dn, $this->gosaUnitTag); if($obj['status'] == "delete"){ FAI::prepare_to_save_FAI_object($sub_dn,array(),true); @@ -412,7 +401,6 @@ class faiVariable extends plugin $this->handle_post_events("add"); } - $this->handle_object_tagging($sub_dn, $this->gosaUnitTag); } } diff --git a/gosa-core/plugins/admin/groups/tabs_group.inc b/gosa-core/plugins/admin/groups/tabs_group.inc index 094551de9..af212368c 100644 --- a/gosa-core/plugins/admin/groups/tabs_group.inc +++ b/gosa-core/plugins/admin/groups/tabs_group.inc @@ -73,10 +73,6 @@ class grouptabs extends tabs $ret= tabs::save(); - /* Fix tagging if needed */ - $baseobject->dn= $new_dn; - $baseobject->handle_object_tagging(); - return $ret; } diff --git a/gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc b/gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc index 9e93bb411..38570fde2 100644 --- a/gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc +++ b/gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc @@ -54,11 +54,6 @@ class mimetabs extends tabs } tabs::save(); - - /* Fix tagging if needed */ - $baseobject->dn= $this->dn; - $baseobject->handle_object_tagging(); - $this->by_object['mimetype'] = $baseobject; } } diff --git a/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc b/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc index 6d3c018af..3cbeccd92 100644 --- a/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc +++ b/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc @@ -292,10 +292,6 @@ class ogrouptabs extends tabs } tabs::save(); - - /* Fix tagging if needed */ - $baseobject->dn= $new_dn; - $baseobject->handle_object_tagging(); } function getCopyDialog() diff --git a/gosa-core/plugins/admin/systems/class_printGeneric.inc b/gosa-core/plugins/admin/systems/class_printGeneric.inc index 8940a9356..9eec1acaf 100644 --- a/gosa-core/plugins/admin/systems/class_printGeneric.inc +++ b/gosa-core/plugins/admin/systems/class_printGeneric.inc @@ -867,9 +867,6 @@ class printgeneric extends plugin $this->netConfigDNS->dn = $this->dn; $this->netConfigDNS->save(); } - - /* This is a multi object. Handle tagging here... */ - $this->handle_object_tagging(); } function generateList(){ diff --git a/gosa-core/plugins/admin/systems/tabs_component.inc b/gosa-core/plugins/admin/systems/tabs_component.inc index c195da845..ff0c69d9a 100644 --- a/gosa-core/plugins/admin/systems/tabs_component.inc +++ b/gosa-core/plugins/admin/systems/tabs_component.inc @@ -30,9 +30,6 @@ class componenttabs extends tabs } tabs::save(TRUE); - - /* Fix tagging if needed */ - $baseobject->handle_object_tagging(); } } diff --git a/gosa-core/plugins/admin/systems/tabs_phone.inc b/gosa-core/plugins/admin/systems/tabs_phone.inc index 3967b4230..fbf11071a 100644 --- a/gosa-core/plugins/admin/systems/tabs_phone.inc +++ b/gosa-core/plugins/admin/systems/tabs_phone.inc @@ -30,9 +30,6 @@ class phonetabs extends tabs } tabs::save(TRUE); - - /* Fix tagging if needed */ - $baseobject->handle_object_tagging(); } } diff --git a/gosa-core/plugins/admin/systems/tabs_printers.inc b/gosa-core/plugins/admin/systems/tabs_printers.inc index 3142146b0..739777a7e 100644 --- a/gosa-core/plugins/admin/systems/tabs_printers.inc +++ b/gosa-core/plugins/admin/systems/tabs_printers.inc @@ -54,9 +54,6 @@ class printtabs extends tabs } tabs::save(FALSE); - - /* Fix tagging if needed */ - $baseobject->handle_object_tagging(); } } diff --git a/gosa-core/plugins/admin/systems/tabs_server.inc b/gosa-core/plugins/admin/systems/tabs_server.inc index 5ee27ab39..322851b61 100644 --- a/gosa-core/plugins/admin/systems/tabs_server.inc +++ b/gosa-core/plugins/admin/systems/tabs_server.inc @@ -59,9 +59,6 @@ class servtabs extends tabs $config = session::get('config'); $config->load_servers(); session::set('config',$config); - - /* Fix tagging if needed */ - $baseobject->handle_object_tagging(); } } diff --git a/gosa-core/plugins/admin/systems/tabs_terminal.inc b/gosa-core/plugins/admin/systems/tabs_terminal.inc index 9f602e370..ea9207faf 100644 --- a/gosa-core/plugins/admin/systems/tabs_terminal.inc +++ b/gosa-core/plugins/admin/systems/tabs_terminal.inc @@ -69,9 +69,6 @@ class termtabs extends tabs $this->by_object['printgeneric']->remove_from_parent(); } } - - /* Fix tagging if needed */ - $baseobject->handle_object_tagging(); } } diff --git a/gosa-core/plugins/admin/systems/tabs_winstation.inc b/gosa-core/plugins/admin/systems/tabs_winstation.inc index cada48b80..3adcb2de6 100644 --- a/gosa-core/plugins/admin/systems/tabs_winstation.inc +++ b/gosa-core/plugins/admin/systems/tabs_winstation.inc @@ -36,9 +36,6 @@ class wintabs extends tabs } tabs::save(TRUE); - - /* Fix tagging if needed */ - $baseobject->handle_object_tagging(); } } diff --git a/gosa-core/plugins/admin/systems/tabs_workstation.inc b/gosa-core/plugins/admin/systems/tabs_workstation.inc index 5660acb29..3d6bac27c 100644 --- a/gosa-core/plugins/admin/systems/tabs_workstation.inc +++ b/gosa-core/plugins/admin/systems/tabs_workstation.inc @@ -67,9 +67,6 @@ class worktabs extends tabs $this->by_object['printgeneric']->remove_from_parent(); } } - - /* Fix tagging if needed */ - $baseobject->handle_object_tagging(); } } diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index ee7da75d6..9e75338d0 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -1052,9 +1052,6 @@ class user extends plugin $this->handle_post_events("modify", array("uid" => $this->uid)); } - /* Fix tagging if needed */ - $this->handle_object_tagging(); - return (0); } -- 2.30.2