From b99da83165c822cdbaef7bc2f7900122183cbdd9 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 6 Dec 2006 07:20:01 +0000 Subject: [PATCH] Fixed base selection && creation check for systems git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5316 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_componentGeneric.inc | 12 +----------- plugins/admin/systems/class_phoneGeneric.inc | 12 +----------- plugins/admin/systems/class_printGeneric.inc | 11 ----------- plugins/admin/systems/class_servGeneric.inc | 14 ++------------ plugins/admin/systems/class_terminalGeneric.inc | 10 ---------- plugins/admin/systems/class_workstationGeneric.inc | 11 ----------- 6 files changed, 4 insertions(+), 66 deletions(-) diff --git a/plugins/admin/systems/class_componentGeneric.inc b/plugins/admin/systems/class_componentGeneric.inc index d05af5d66..2e6f70298 100644 --- a/plugins/admin/systems/class_componentGeneric.inc +++ b/plugins/admin/systems/class_componentGeneric.inc @@ -56,7 +56,7 @@ class componentGeneric extends plugin foreach($_POST as $name => $value){ if(preg_match("/^chooseBase/",$name) && $once){ $once = false; - $this->dialog = new baseSelectDialog($this->config,$this); + $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); $this->dialog->setCurrentBase($this->base); } } @@ -181,16 +181,6 @@ class componentGeneric extends plugin } } - /* Set new acl base */ - if($this->dn == "new") { - $this->set_acl_base($this->base); - } - - $ui= get_userinfo(); - if ($this->dn == "new" && !$this->acl_is_createable()){ - $message[]= _("You have no permissions to create a component on this 'Base'."); - } - if ($this->orig_dn != $this->dn){ $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->base); diff --git a/plugins/admin/systems/class_phoneGeneric.inc b/plugins/admin/systems/class_phoneGeneric.inc index 4b6150907..928b7e317 100644 --- a/plugins/admin/systems/class_phoneGeneric.inc +++ b/plugins/admin/systems/class_phoneGeneric.inc @@ -124,7 +124,7 @@ class phoneGeneric extends plugin foreach($_POST as $name => $value){ if(preg_match("/^chooseBase/",$name) && $once){ $once = false; - $this->dialog = new baseSelectDialog($this->config,$this); + $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); $this->dialog->setCurrentBase($this->base); } } @@ -328,16 +328,6 @@ class phoneGeneric extends plugin $message[]= _("The 'Phone name' '0' is reserved and cannot be used."); } - /* Set new acl base */ - if($this->dn == "new") { - $this->set_acl_base($this->base); - } - - $ui= get_userinfo(); - if ($this->dn == "new" && $this->acl_is_createable()){ - $message[]= _("You have no permissions to create a phone on this 'Base'."); - } - if ($this->orig_dn != $this->dn){ $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->base); diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 7b55b0ed4..9457f8e02 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -657,17 +657,6 @@ class printgeneric extends plugin $message[]= "The required field 'Printer name' is not set."; } - /* Set new acl base */ - if($this->dn == "new") { - $this->set_acl_base($this->base); - } - - if(preg_match("/printer/i",$this->BelongsTo)){ - if ($this->orig_dn == "new" && !$this->acl_is_createable()){ - $message[]= _("You have no permissions to create a group on this 'Base'."); - } - } - /* must: labeledURI */ if(empty($this->labeledURI)){ $message[]= "The required field 'Printer URL' is not set."; diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc index a840bca11..527f56bd8 100644 --- a/plugins/admin/systems/class_servGeneric.inc +++ b/plugins/admin/systems/class_servGeneric.inc @@ -252,16 +252,6 @@ class servgeneric extends plugin $message[]= _("The required field 'Server name' is not set."); } - /* Set new acl base */ - if($this->dn == "new") { - $this->set_acl_base($this->base); - } - - $ui= get_userinfo(); - if (!$this->acl_is_createable() && $this->dn == "new"){ - $message[]= _("You have no permissions to create a server on this 'Base'."); - } - if ($this->orig_dn != $this->dn){ $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->base); @@ -270,8 +260,8 @@ class servgeneric extends plugin while ($attrs= $ldap->fetch()){ if ($attrs['dn'] != $this->orig_dn){ if(!preg_match("/,ou=incoming,/",$attrs['dn'])){ - $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); - break; + $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); + break; } } } diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index b82f778be..ca138cc72 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -401,16 +401,6 @@ class termgeneric extends plugin /* Permissions for that base? */ $this->dn= "cn=".$this->cn.",ou=terminals,ou=systems,".$this->base; - /* Set new acl base */ - if($this->dn == "new") { - $this->set_acl_base($this->base); - } - - $ui= get_userinfo(); - if ($this->dn == "new" && !$this->acl_is_createable()){ - $message[]= _("You have no permissions to create a terminal on this 'Base'."); - } - if ($this->cn == ""){ $message[]= _("The required field 'Terminal name' is not set."); } diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 7a4bbe895..0330d015e 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -220,7 +220,6 @@ class workgeneric extends plugin if($this->dialog->isClosed()){ $this->dialog = false; }elseif($this->dialog->isSelected()){ - $this->base = $this->dialog->isSelected(); /* A new base was selected, check if it is a valid one */ $tmp = $this->get_allowed_bases(); @@ -384,16 +383,6 @@ class workgeneric extends plugin $this->dn= "cn=".$this->cn.",ou=workstations,ou=systems,".$this->base; - /* Set new acl base */ - if($this->dn == "new") { - $this->set_acl_base($this->base); - } - - if ($this->orig_dn == "new" && !$this->acl_is_createable()){ - $message[]= _("You have no permissions to create a workstation on this 'Base'."); - } - - if ($this->cn == ""){ $message[]= _("The required field 'Workstation name' is not set."); } -- 2.30.2