From: hickert Date: Thu, 21 Jun 2007 08:50:36 +0000 (+0000) Subject: Added check to prevent overwriting existing sub entries of fai object X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e7ab9026f083a1a67462e884f16b333a36c22d06;p=gosa.git Added check to prevent overwriting existing sub entries of fai object git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6645 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_faiHookEntry.inc b/plugins/admin/fai/class_faiHookEntry.inc index 415a1cb45..469f17c6d 100644 --- a/plugins/admin/fai/class_faiHookEntry.inc +++ b/plugins/admin/fai/class_faiHookEntry.inc @@ -17,7 +17,7 @@ class faiHookEntry extends plugin var $FAIscript = ""; var $description = ""; var $status = "new"; - + var $parent = NULL; var $FAIstate = ""; function faiHookEntry ($config, $dn= NULL,$object=false) @@ -134,6 +134,10 @@ class faiHookEntry extends plugin /* Call common method to give check the hook */ $message= plugin::check(); + if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){ + $message[] =_("There is already a hook with the given name."); + } + if(empty($this->FAIscript)) { $message[]=_("Please enter a value for script."); } diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index 401dcde4a..537c35318 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -131,6 +131,7 @@ class faiScript extends plugin if(isset($_POST['AddSubObject'])){ $this->dialog= new $this->subClassName($this->config,"new"); $this->dialog->acl = $this->acl; + $this->dialog->parent = &$this; $this->is_dialog=true; } diff --git a/plugins/admin/fai/class_faiScriptEntry.inc b/plugins/admin/fai/class_faiScriptEntry.inc index 1e44dc734..e2379f7ef 100644 --- a/plugins/admin/fai/class_faiScriptEntry.inc +++ b/plugins/admin/fai/class_faiScriptEntry.inc @@ -15,7 +15,7 @@ class faiScriptEntry extends plugin var $FAIscript = ""; var $description = ""; var $status = "new"; - + var $parent = NULL; var $FAIstate = ""; function faiScriptEntry ($config, $dn= NULL,$object=false) @@ -124,6 +124,10 @@ class faiScriptEntry extends plugin /* Call common method to give check the hook */ $message= plugin::check(); + if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){ + $message[] =_("There is already a script with the given name."); + } + if(empty($this->cn)){ $message[] = _("Please enter a name."); } diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index dd614d398..62dab484c 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -164,6 +164,7 @@ class faiTemplate extends plugin if(isset($_POST['AddSubObject'])){ $this->dialog= new $this->subClassName($this->config,"new"); $this->dialog->acl = $this->acl; + $this->dialog->parent = &$this; $this->is_dialog=true; } diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc index 2c9a4dc98..464683952 100644 --- a/plugins/admin/fai/class_faiTemplateEntry.inc +++ b/plugins/admin/fai/class_faiTemplateEntry.inc @@ -20,7 +20,7 @@ class faiTemplateEntry extends plugin var $user = "root"; var $group = "root"; var $binary = false; - + var $parent = NULL; var $FAIstate = ""; function faiTemplateEntry ($config, $dn= NULL,$object=false) @@ -175,6 +175,10 @@ class faiTemplateEntry extends plugin /* Call common method to give check the hook */ $message= plugin::check(); + if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){ + $message[] =_("There is already a template with the given name."); + } + if(empty($this->FAItemplateFile)){ $message[]=_("Please specify a value for attribute 'file'."); } diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index 35a071ef5..171ad312d 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -103,8 +103,9 @@ class faiVariable extends plugin /* Add new sub object */ if(isset($_POST['AddSubObject'])){ - $this->dialog= new $this->subClassName($this->config,"new"); - $this->dialog->acl = $this->acl; + $this->dialog = new $this->subClassName($this->config,"new"); + $this->dialog->acl = $this->acl; + $this->dialog->parent = $this; $this->is_dialog=true; } @@ -119,6 +120,7 @@ class faiVariable extends plugin $var = $_POST['SubObject'][0]; $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$var]); $this->dialog->acl = $this->acl; + $this->dialog->parent = $this; $_SESSION['objectinfo'] = $this->SubObjects[$var]['dn']; $this->is_dialog=true; } diff --git a/plugins/admin/fai/class_faiVariableEntry.inc b/plugins/admin/fai/class_faiVariableEntry.inc index e543ff23c..b5814a0e8 100644 --- a/plugins/admin/fai/class_faiVariableEntry.inc +++ b/plugins/admin/fai/class_faiVariableEntry.inc @@ -13,7 +13,7 @@ class faiVariableEntry extends plugin var $FAIvariableContent = ""; var $description = ""; var $status = "new"; - + var $parent = NULL; var $FAIstate = ""; function faiVariableEntry ($config, $dn= NULL,$object=false) @@ -88,6 +88,10 @@ class faiVariableEntry extends plugin { /* Call common method to give check the hook */ $message= plugin::check(); + + if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){ + $message[] =_("There is already a variable with the given name."); + } if(empty($this->FAIvariableContent)) { $message[]=_("Please specify a value for the attribute 'content'.");