From: hickert Date: Tue, 24 Oct 2006 11:01:30 +0000 (+0000) Subject: Added acls to fax blocklists X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=eebf6579ccb529666ef5641191b8151e1d9f7dbe;p=gosa.git Added acls to fax blocklists git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4924 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc index 9b946ee97..a27d03319 100644 --- a/plugins/gofax/blocklists/class_blocklistManagement.inc +++ b/plugins/gofax/blocklists/class_blocklistManagement.inc @@ -177,7 +177,7 @@ class blocklist extends plugin /* Finally delete blocklist */ if (isset($_POST['delete_blocklist_confirm'])){ - if (chkacl($this->acl, "delete") == ""){ + if ($this->acl_is_removeable()){ $this->remove_from_parent(); gosa_log ("Blocklist object'".$this->dn."' has been removed"); $this->reload (); @@ -250,6 +250,10 @@ class blocklist extends plugin if($this->dn){ + $this->set_acl_category("gofax"); + $this->set_acl_base($this->dn); + + /* Base select dialog */ $once = true; foreach($_POST as $name => $value){ @@ -298,15 +302,24 @@ class blocklist extends plugin $smarty->assign("mode", "readonly"); $smarty->assign("apply", "1"); } + + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + foreach(array("cn", "description", "type", "goFaxBlocklist") as $val){ $smarty->assign("$val", $this->$val); - $smarty->assign("$val"."ACL", chkacl($this->acl, "$val")); } - /* Lock blocklist type for non new entries */ - if ($this->dn != "new"){ - $smarty->assign('typeACL', "disabled"); + $baseACL = $this->getacl("base"); + if(!$this->acl_is_moveable()) { + $baseACL = preg_replace("/w/","",$baseACL); } + $smarty->assign("baseACL", $baseACL); + + /* Lock blocklist type for non new entries */ + $smarty->assign('typeACL',$this->getacl("type", ($this->dn != "new"))); /* Show main page */ return($smarty->fetch (get_template_path('generic.tpl', TRUE))); @@ -418,15 +431,21 @@ class blocklist extends plugin $this->DivListBlocklist->save_object(); plugin::save_object(); - if(isset($_POST['base'])){ + $baseACL = $this->getacl("base"); + if(!$this->acl_is_moveable()) { + $baseACL = preg_replace("/w/","",$baseACL); + } + + if(isset($_POST['base']) && preg_match("/w/",$baseACL)){ $this->base = $_POST['base']; } + foreach($this->attributes as $attr){ - if(isset($_POST[$attr])){ + if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){ $this->$attr = $_POST[$attr]; } } - if(isset($_POST['type'])){ + if(isset($_POST['type']) && $this->acl_is_writeable("type",($this->dn != "new"))){ $this->type = $_POST['type']; } } @@ -445,11 +464,10 @@ class blocklist extends plugin $new_dn= $this->dn; } - if (chkacl($this->acl, "create") != ""){ + if (!$this->acl_is_createable() && $this->dn == "new"){ $message[]= _("You have no permissions to create a blocklist on this 'Base'."); } - /* check syntax: must cn */ if ($this->cn == ""){ $message[]= _("Required field 'Name' is not set."); @@ -467,11 +485,6 @@ class blocklist extends plugin } } - /* Is user allowed to create in 'base'? */ - if (chkacl($this->acl, "create") != ""){ - $message[]= _("No permission to create a blocklist on this base."); - } - return $message; } @@ -565,13 +578,11 @@ class blocklist extends plugin "plSection" => array("administration" => _("FAX Blocklists")), "plCategory" => array("gofax" => array("description" => _("Fax"), "objectClass" => array("goFaxRBlock","goFaxSBlock"))), - - - "plProvidedAcls" => array( "cn" => _("Name"), "description" => _("Description"), "base" => _("Base"), + "goFaxBlocklist" => _("Blocklist"), "type" => _("Blocklist type")) )); } diff --git a/plugins/gofax/blocklists/class_divListBlocklists.inc b/plugins/gofax/blocklists/class_divListBlocklists.inc index bada73d0a..bf03065b1 100755 --- a/plugins/gofax/blocklists/class_divListBlocklists.inc +++ b/plugins/gofax/blocklists/class_divListBlocklists.inc @@ -69,14 +69,32 @@ class divListBlocklist extends MultiSelectWindow which are shown in the listbox on top of the listbox */ $options= ""; - foreach ($this->config->idepartments as $key => $value){ - if ($this->selectedBase == $key){ - $options.= ""; - } else { - $options.= ""; + + /* Get all departments within this subtree */ + $base = $this->config->current['BASE']; + + $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base, + array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH); + + /* Load possible departments */ + $ui= get_userinfo(); + $tdeps= $ui->get_module_departments("gofax"); + + $ids = $this->config->idepartments; + + foreach($deps as $dep){ + if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){ + + $value = $ids[$dep['dn']]; + if ($this->selectedBase == $dep['dn']){ + $options.= ""; + } else { + $options.= ""; + } } } - + + /* NEW LIST MANAGMENT */ $listhead = "
". " {$must} - + +{render acl=$cnACL} + +{/render} {$must} - - {if $selectmode == ""} - - {else} - - {/if} +{render acl=$baseACL} + +{/render} + +{render acl=$baseACL disable_picture='images/folder_gray.png'} + +{/render} @@ -36,16 +39,20 @@ - + {html_options options=$types selected=$type} +{/render} - +{render acl=$descriptionACL} + +{/render} @@ -59,14 +66,22 @@

{t}Blocked numbers{/t}

+{render acl=$goFaxBlocklistACL} +{/render}
+{render acl=$goFaxBlocklistACL}   +{/render} +{render acl=$goFaxBlocklistACL}   +{/render} +{render acl=$goFaxBlocklistACL} +{/render}