From: cajus Date: Mon, 10 Mar 2008 14:05:55 +0000 (+0000) Subject: Made add and selftag work X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=41d35af0b199a554645f07a77c763b3dfe0ac0e2;p=gosa.git Made add and selftag work git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9594 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc index fc808e028..c3a15fdb7 100644 --- a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc @@ -324,34 +324,37 @@ class department extends plugin $this->skipTagging = TRUE; plugin::save(); - $this->attrs['gosaUnitTag'] = $this->gosaUnitTag; - /* 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; - $this->attrs['gosaUnitTag']= array(); - $this->gosaUnitTag = ""; + } + + /* Do we need to remove the tag itself? */ + $has_unit_tag= false; + foreach($this->attrs['objectClass'] as $oc){ + if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){ + $has_unit_tag= true; + } + } + if ($has_unit_tag == false && $this->is_administrational_unit == false){ + unset ($this->attrs['gosaUnitTag']); + } else { + $this->attrs['gosaUnitTag']= $this->gosaUnitTag; } /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); $ldap->cat($this->dn, array('dn')); - $a= $ldap->fetch(); $ldap->cd($this->dn); - if (count($a)){ + if ($ldap->count()){ $this->cleanup(); $ldap->modify ($this->attrs); new log("modify","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); @@ -362,7 +365,7 @@ class department extends plugin new log("create","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } if (!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); } /* The parameter forces only to set must_be_tagged, and don't touch any objects diff --git a/gosa-core/plugins/admin/departments/tabs_department.inc b/gosa-core/plugins/admin/departments/tabs_department.inc index c7a75dbc5..ef0360892 100644 --- a/gosa-core/plugins/admin/departments/tabs_department.inc +++ b/gosa-core/plugins/admin/departments/tabs_department.inc @@ -31,6 +31,7 @@ class deptabs extends tabs /* Add references/acls/snapshots */ $this->addSpecialTabs(); + $this->by_object['acl']->skipTagging= TRUE;; } function check($ignore_account= FALSE) @@ -63,7 +64,9 @@ class deptabs extends tabs $this->dn= $new_dn; $baseobject->dn= $this->dn; $this->by_object['department']= $baseobject; - return(tabs::save(TRUE)); + if (!$ignore_account){ + tabs::save(TRUE); + } }