X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Fsystems%2Fadmin%2Fsystems%2Fclass_servGeneric.inc;h=cc451e00662f2ec79855955c178697e004c535b0;hb=bcf8cfc0e3032ad9f1aae4ade00cce5331f26316;hp=f791615f68fd2936ced971b8bcea92cd63af0f8a;hpb=912e6850eaab8766b773e33e84e698d8ac4e8d44;p=gosa.git diff --git a/gosa-plugins/systems/admin/systems/class_servGeneric.inc b/gosa-plugins/systems/admin/systems/class_servGeneric.inc index f791615f6..cc451e006 100644 --- a/gosa-plugins/systems/admin/systems/class_servGeneric.inc +++ b/gosa-plugins/systems/admin/systems/class_servGeneric.inc @@ -32,6 +32,8 @@ class servgeneric extends plugin var $l= ""; var $description= ""; var $orig_dn= ""; + var $orig_cn= ""; + var $orig_base= ""; /* attribute list for save action */ var $attributes= array("cn", "description","gotoMode"); @@ -72,7 +74,7 @@ class servgeneric extends plugin $this->base= dn2base($ui->dn); $this->cn= ""; } else { - $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn); + $this->base= preg_replace ("/^[^,]+,".normalizePreg(get_ou("serverou"))."/", "", $this->dn); } $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses); $this->netConfigDNS->set_acl_category("server"); @@ -92,7 +94,9 @@ class servgeneric extends plugin } /* Save dn for later references */ - $this->orig_dn= $this->dn; + $this->orig_dn = $this->dn; + $this->orig_cn = $this->cn; + $this->orig_base = $this->base; } @@ -122,7 +126,7 @@ class servgeneric extends plugin /* Do we represent a valid server? */ if (!$this->is_account && $this->parent === NULL){ - $display= "\"\" ". + $display= "\"\" ". msgPool::noValidExtension(_("server")).""; return($display); } @@ -241,6 +245,8 @@ class servgeneric extends plugin $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); + update_accessTo($this->orig_cn,""); + new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); if (!$ldap->success()){ @@ -322,9 +328,22 @@ class servgeneric extends plugin } /* Warn the user, that this host is currently installing */ - if($this->currently_installing && !$this->currently_installing_warned){ + if($this->currently_installing && !$this->currently_installing_warned && !preg_match("/".normalizePreg(get_ou("incomingou"))."/",$this->orig_dn)){ + + /* Force aborting without message dialog */ + $message[] = ""; $this->currently_installing_warned = TRUE; - $message[] = _("This host is currently installing, if you really want to save it, save again."); + msg_dialog::display(_("Software deployment"), + _("This host is currently installing, if you really want to save it, press 'OK'."), + CONFIRM_DIALOG); + } + + /* Check if we are allowed to create or move this object + */ + if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){ + $message[] = msgPool::permCreate(); + }elseif($this->cn != $this->orig_cn || $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){ + $message[] = msgPool::permMove(); } return ($message); @@ -364,25 +383,17 @@ class servgeneric extends plugin new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $mode= "add"; } else { - - /* cn is not case sensitive for ldap, but for php it is!! */ - if($this->config->current['DNMODE'] == "cn"){ - if (strtolower($this->orig_dn) != (strtolower($this->dn))){ - $this->recursive_move($this->orig_dn, $this->dn); - plugin::save(); - } - }else{ - if ($this->orig_dn != $this->dn){ - $this->recursive_move($this->orig_dn, $this->dn); - plugin::save(); - } - } $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + /* Update all accessTo/trust dependencies */ + if($this->orig_cn != $this->cn){ + update_accessTo($this->orig_cn,$this->cn); + } + $mode= "modify"; } if (!$ldap->success()){