X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fplugins%2Fadmin%2Fdepartments%2Fclass_departmentGeneric.inc;h=b3c8819e37d164da25dcdc2e26b0e6ed5a9ef8ee;hb=aef3764e59812f70fa8345505c4cdcf22bb4ebb0;hp=e76d4e38645124a79c864fe6655d8272e212b151;hpb=03d7b0b804bf70999933386682c2712313c23d28;p=gosa.git diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc index e76d4e386..b3c8819e3 100644 --- a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc @@ -312,33 +312,27 @@ class department extends plugin $this->skipTagging = TRUE; plugin::save(); + /* Remove tag information if needed */ - if (!$this->is_administrational_unit){ + if (!$this->is_administrational_unit && $this->initially_was_tagged){ $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; - } - - /* 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){ $this->attrs['gosaUnitTag']= array(); $this->gosaUnitTag = ""; - } else { - $this->attrs['gosaUnitTag']= $this->gosaUnitTag; } + /* Write back to ldap */ $ldap->cat($this->dn, array('dn')); $ldap->cd($this->dn); @@ -659,7 +653,47 @@ class department extends plugin @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging"); } } + } + + + + /*! \brief Returns a list of all available departments for this object. + If this object is new, all departments we are allowed to create a new user in are returned. + If this is an existing object, return all deps. we are allowed to move tis object too. + + @return Array [dn] => "..name" // All deps. we are allowed to act on. + */ + function get_allowed_bases() + { + $ui = get_userinfo(); + $deps = array(); + + /* Is this a new object ? Or just an edited existing object */ + if(!$this->initially_was_account && $this->is_account){ + $new = true; + }else{ + $new = false; + } + + $ideps = $this->config->idepartments; + if(!isset($ideps[$this->base])){ + $ideps[$this->base] = "."; + } + foreach($deps as $dn => $name){ + if($new && $this->acl_is_createable($dn)){ + $deps[$dn] = $name; + }elseif(!$new && $this->acl_is_moveable($dn)){ + $deps[$dn] = $name; + } + } + /* Add current base */ + if(isset($this->base) && isset($ideps[$this->base])){ + $deps[$this->base] = $ideps[$this->base]; + }else{ + trigger_error("Cannot return list of departments, no default base found in class ".get_class($this).". ".$this->base); + } + return($deps); } }