From bf45a0b158421ccc3804bd6d4e17cf217daa570d Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 22 Nov 2006 07:42:16 +0000 Subject: [PATCH] Disabled tagging functionality git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5186 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../departments/class_departmentGeneric.inc | 171 ++++++++++-------- plugins/admin/departments/generic.tpl | 9 + 2 files changed, 105 insertions(+), 75 deletions(-) diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 36e960663..e5e21639c 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -50,6 +50,14 @@ class department extends plugin var $objectclasses= array("top", "gosaDepartment", "organizationalUnit"); var $initially_was_tagged = false; + + /* Temporary disable the Unit Tag functionalityi. + This is not used anymore, cause of the new acl implementation. + Setting this to TRUE will disable + all POST / GET activity, "Department tagging" and the checkbox within the generic template. + */ + var $UnitTagDiabled = TRUE; + function department ($config, $dn) { @@ -147,12 +155,15 @@ class department extends plugin } $smarty->assign("base_select", $this->base); - /* Set admin unit flag */ - if ($this->is_administrational_unit) { - $smarty->assign("unitTag", "checked"); - } else { - $smarty->assign("unitTag", ""); - } + /* Set admin unit flag */ + $smarty->assign("UnitTagDiabled",$this->UnitTagDiabled); + if(!$this->UnitTagDiabled){ + if ($this->is_administrational_unit) { + $smarty->assign("unitTag", "checked"); + } else { + $smarty->assign("unitTag", ""); + } + } return($smarty->fetch (get_template_path('generic.tpl', TRUE))); } @@ -198,17 +209,19 @@ class department extends plugin /* Save base, since this is no LDAP attribute */ if($this->acl_is_moveable() && isset($_POST['base'])){ $this->base= $_POST['base']; - } + } - /* Save tagging flag */ - if ($this->acl_is_writeable("unitTag")){ - if (isset($_POST['unitTag'])){ - $this->is_administrational_unit= true; - } else { - $this->is_administrational_unit= false; - } - } - } + /* Save tagging flag */ + if(!$this->UnitTagDiabled){ + if ($this->acl_is_writeable("unitTag")){ + if (isset($_POST['unitTag'])){ + $this->is_administrational_unit= true; + } else { + $this->is_administrational_unit= false; + } + } + } + } } @@ -270,66 +283,71 @@ class department extends plugin { $ldap= $this->config->get_ldap_link(); - /* Add tag objects if needed */ - if ($this->is_administrational_unit){ + if(!$this->UnitTagDiabled){ - /* If this wasn't tagged before add oc an reset unit tag */ - if(!$this->initially_was_tagged){ - $this->objectclasses[]= "gosaAdministrativeUnit"; - $this->gosaUnitTag= ""; - - /* It seams that this method is called twice, - set this to true. to avoid adding this oc twice */ - $this->initially_was_tagged = true; - } + /* Add tag objects if needed */ + if ($this->is_administrational_unit){ - if ($this->gosaUnitTag == ""){ + /* If this wasn't tagged before add oc an reset unit tag */ + if(!$this->initially_was_tagged){ + $this->objectclasses[]= "gosaAdministrativeUnit"; + $this->gosaUnitTag= ""; - /* It's unlikely, but check if already used... */ - $try= 5; - $ldap->cd($this->config->current['BASE']); - while ($try--){ - - /* Generate microtime stamp as tag */ - list($usec, $sec)= explode(" ", microtime()); - $time_stamp= preg_replace("/\./", "", $sec.$usec); - - $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag")); - if ($ldap->count() == 0){ - break; - } - } - if($try == 0) { - print_red(_("Fatal error: Can't find an unused tag to mark the administrative unit!")); - return; - } - $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec); - } - } + /* It seams that this method is called twice, + set this to true. to avoid adding this oc twice */ + $this->initially_was_tagged = true; + } + if ($this->gosaUnitTag == ""){ + + /* It's unlikely, but check if already used... */ + $try= 5; + $ldap->cd($this->config->current['BASE']); + while ($try--){ + + /* Generate microtime stamp as tag */ + list($usec, $sec)= explode(" ", microtime()); + $time_stamp= preg_replace("/\./", "", $sec.$usec); + + $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag")); + if ($ldap->count() == 0){ + break; + } + } + if($try == 0) { + print_red(_("Fatal error: Can't find an unused tag to mark the administrative unit!")); + return; + } + $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec); + } + } + } plugin::save(); - /* Remove tag information if needed */ - if (!$this->is_administrational_unit){ - $tmp= array(); - - /* Remove gosaAdministrativeUnit from this plugin */ - $has_unit_tag= false; - foreach($this->attrs['objectClass'] as $oc){ - if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){ - $tmp[]= $oc; - } - if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){ - $has_unit_tag= true; - } - } - $this->attrs['objectClass']= $tmp; + if(!$this->UnitTagDiabled){ + + /* Remove tag information if needed */ + if (!$this->is_administrational_unit){ + $tmp= array(); + + /* Remove gosaAdministrativeUnit from this plugin */ + $has_unit_tag= false; + foreach($this->attrs['objectClass'] as $oc){ + if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){ + $tmp[]= $oc; + } + if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){ + $has_unit_tag= true; + } + } + $this->attrs['objectClass']= $tmp; - if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){ - $this->attrs['gosaUnitTag']= array(); - } - $this->gosaUnitTag = ""; - } + if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){ + $this->attrs['gosaUnitTag']= array(); + } + $this->gosaUnitTag = ""; + } + } /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); @@ -348,13 +366,16 @@ class department extends plugin } show_ldap_error($ldap->get_error(), sprintf(_("Saving of department with dn '%s' failed."),$this->dn)); - /* 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(); + if(!$this->UnitTagDiabled){ + /* 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 */ diff --git a/plugins/admin/departments/generic.tpl b/plugins/admin/departments/generic.tpl index ed1a09eda..bfb6c139c 100644 --- a/plugins/admin/departments/generic.tpl +++ b/plugins/admin/departments/generic.tpl @@ -101,6 +101,14 @@ + +{if !$UnitTagDiabled} + + +

 

@@ -114,6 +122,7 @@
+{/if}