From 1697b635d0c6a520a7b37ec37a7eb903a6003821 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 6 Dec 2006 07:23:32 +0000 Subject: [PATCH] Fixed macro base selection and checks git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5318 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/gofon/macro/class_gofonMacro.inc | 34 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index 981b526c2..1b091cf07 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -107,7 +107,7 @@ class macro 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); } } @@ -120,7 +120,12 @@ class macro 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(); + if(isset($tmp[$this->dialog->isSelected()])){ + $this->base = $this->dialog->isSelected(); + } $this->dialog= false; }else{ return($this->dialog->execute()); @@ -131,13 +136,6 @@ class macro extends plugin $smarty= get_smarty(); $smarty->assign("bases", $this->get_allowed_bases()); - /* Assign base ACL */ - $baseACL = $this->getacl("base"); - if(!$this->acl_is_moveable()) { - $baseACL = preg_replace("/w/","",$baseACL); - } - $smarty->assign("baseACL", $baseACL); - $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translation){ $smarty->assign($name."ACL",$this->getacl($name)); @@ -358,10 +356,24 @@ class macro extends plugin function save_object() { if (isset($_POST['gofonMacroGenericPosted'])){ - $old_cn= $this->cn; - $old_visible = $this->goFonMacroVisible; + $old_cn = $this->cn; + $old_visible = $this->goFonMacroVisible; + + /* Create a base backup and reset the + base directly after calling plugin::save_object(); + Base will be set seperatly a few lines below */ + $base_tmp = $this->base; plugin::save_object(); + $this->base = $base_tmp; + + /* Save base, since this is no LDAP attribute */ + $tmp = $this->get_allowed_bases(); + if(isset($_POST['base'])){ + if(isset($tmp[$_POST['base']])){ + $this->base= $_POST['base']; + } + } /* Restore old cn if we have insuficient acls to change cn ... */ if(!$this->acl_is_writeable("cn",!$this->is_new)){ -- 2.30.2