From 34ca62abdd86f090634e11b923a9c340c817681b Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 25 Oct 2006 06:22:56 +0000 Subject: [PATCH] Added some acls to gofon macro management git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4933 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/gofon/macro/class_divListMacros.inc | 68 ++++++++++++++----- .../macro/class_gofonMacroManagement.inc | 56 ++++++++------- 2 files changed, 79 insertions(+), 45 deletions(-) diff --git a/plugins/gofon/macro/class_divListMacros.inc b/plugins/gofon/macro/class_divListMacros.inc index 5ffdd1447..68dce0468 100755 --- a/plugins/gofon/macro/class_divListMacros.inc +++ b/plugins/gofon/macro/class_divListMacros.inc @@ -66,14 +66,32 @@ class divListMacro 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("groups"); + + $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.= ""; + } } } + $acls = $ui->get_permissions($this->selectedBase,"gofon/macro"); + /* NEW LIST MANAGMENT */ $listhead = "
". "  ". "  "; - $listhead .= $this->get_snapshot_header($this->selectedBase); - $listhead .= "  ". - "  ". - _("Base")." ". + if(preg_match("/w/",$acls) && preg_match("/c/",$acls)){ + $listhead .= $this->get_snapshot_header($this->selectedBase); + } + if(preg_match("/c/",$acls)){ + $listhead .= "  "; + $listhead .= "  "; + } + $listhead .= _("Base")." ". "  ". "
"; @@ -123,16 +145,30 @@ class divListMacro extends MultiSelectWindow $action_col_size += 20; } + $ui = get_userinfo(); + foreach($list as $key => $val){ - - $action= "get_permissions($val['dn'],"gofon/macro"); + + $action = ""; + if(!preg_match("/r/",$sacl)){ + continue; + } + + $action.= ""; - $action.= $this->GetSnapShotActions($val['dn']); - $action.= ""; - $display= $val["displayName"][0]; + if(preg_match("/c/",$sacl) && preg_match("/w/",$sacl)){ + $action.= $this->GetSnapShotActions($val['dn']); + } + + if(preg_match("/d/",$sacl)){ + $action.= ""; + } + $display= $val["displayName"][0]; if(isset($val['goFonMacroVisible']['0'])&&($val['goFonMacroVisible']['0'] == "1")){ $pic1 = $visible; }else{ diff --git a/plugins/gofon/macro/class_gofonMacroManagement.inc b/plugins/gofon/macro/class_gofonMacroManagement.inc index 1f3bd1e3e..847d404ca 100755 --- a/plugins/gofon/macro/class_gofonMacroManagement.inc +++ b/plugins/gofon/macro/class_gofonMacroManagement.inc @@ -29,7 +29,6 @@ class gofonMacro extends plugin var $macrotabs = NULL; var $macros = array(); var $ui = NULL; - var $acl = ""; var $DivListMacro = NULL; function gofonMacro($config, $ui) @@ -38,9 +37,6 @@ class gofonMacro extends plugin $this->config= $config; $this->ui= $ui; - $acl= get_permissions ($ui->dn, $ui->subtreeACL); - $this->acl= get_module_permission($acl, "goFonMacro", $ui->dn); - $this->DivListMacro = new divListMacro($this->config,$this); } @@ -164,41 +160,43 @@ class gofonMacro extends plugin /* User wants to edit data */ if (($s_action=="edit") && (!isset($this->macrotabs->config))){ - /* Get 'dn' from posted 'macrolists', must be unique */ - $this->dn= $this->macros[$s_entry]['dn']; + $dn = $this->macros[$s_entry]['dn']; + $acl = $this->ui->get_permissions($dn,"gofon/marco"); - /* Check locking, save current plugin in 'back_plugin', so - the dialog knows where to return. */ - if (($user= get_lock($this->dn)) != ""){ - return(gen_locked_message ($user, $this->dn)); - } + if(preg_match("/r/",$acl)){ + $this->dn = $dn; - /* Lock the current entry, so everyone will get the - above dialog */ - add_lock ($this->dn, $this->ui->dn); - /* Register macrotabs to trigger edit dialog */ - $this->macrotabs= new macrotabs($this->config, - $this->config->data['TABS']['MACROTABS'], $this->dn); - $_SESSION['objectinfo']= $this->dn; - } + /* Check locking, save current plugin in 'back_plugin', so + the dialog knows where to return. */ + if (($user= get_lock($this->dn)) != ""){ + return(gen_locked_message ($user, $this->dn)); + } + /* Lock the current entry, so everyone will get the + above dialog */ + add_lock ($this->dn, $this->ui->dn); + /* Register macrotabs to trigger edit dialog */ + $this->macrotabs= new macrotabs($this->config, + $this->config->data['TABS']['MACROTABS'], $this->dn); + $_SESSION['objectinfo']= $this->dn; + } + } /***************** Remove marco *****************/ - + /* Remove user was requested */ if ($s_action=="del"){ /* Get 'dn' from posted 'uid' */ - $this->dn= $this->macros[$s_entry]['dn']; + $dn = $this->macros[$s_entry]['dn']; + $acl = $this->ui->get_permissions($dn,"gofon/marco"); - /* Load permissions for selected 'dn' and check if - we're allowed to remove this 'dn' */ - $acl= get_permissions ($this->dn, $this->ui->subtreeACL); - $this->acl= get_module_permission($acl, "goFonMacro", $this->dn); - if (chkacl($this->acl, "delete") == ""){ + if(preg_match("/d/",$acl)){ + $this->dn = $dn; + /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */ if (($user= get_lock($this->dn)) != ""){ @@ -226,9 +224,9 @@ class gofonMacro extends plugin /* Confirmation for deletion has been passed. Macro should be deleted. */ if (isset($_POST['delete_macro_confirm'])){ - /* Some nice guy may send this as POST, so we've to check - for the permissions again. */ - if (chkacl($this->acl, "delete") == ""){ + $acl = $this->ui->get_permissions($this->dn,"gofon/marco"); + + if(preg_match("/r/",$acl)){ /* Delete request is permitted, perform LDAP action */ $this->macrotabs= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $this->dn); -- 2.30.2