From f6f619f71f447b990fc569f63c30555101c017b8 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 11 Jan 2007 11:04:16 +0000 Subject: [PATCH] Hide not allowed options git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5533 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/ogroups/class_divListOGroup.inc | 32 +++++++++++-------- plugins/admin/ogroups/class_mailogroup.inc | 9 +++++- plugins/admin/ogroups/class_ogroup.inc | 20 ++++++------ .../admin/ogroups/class_ogroupManagement.inc | 32 ++++++++++++++++--- plugins/admin/ogroups/class_phonequeue.inc | 18 ++++++++--- plugins/admin/ogroups/class_termgroup.inc | 6 ++-- plugins/admin/ogroups/phonequeue.tpl | 2 +- 7 files changed, 81 insertions(+), 38 deletions(-) diff --git a/plugins/admin/ogroups/class_divListOGroup.inc b/plugins/admin/ogroups/class_divListOGroup.inc index a40237fac..52693207f 100755 --- a/plugins/admin/ogroups/class_divListOGroup.inc +++ b/plugins/admin/ogroups/class_divListOGroup.inc @@ -117,19 +117,6 @@ class divListOGroup extends MultiSelectWindow { /* Add Copy & Paste buttons if copy&paste is enabled */ - /* Create action icons */ - $actions = ""; - if($this->parent->CopyPasteHandler){ - $actions.= " "; - $actions.= " "; - } - $actions.= ""; - $actions.= ""; - // Defining Links $linkopen = "%s"; $editlink = "%s"; @@ -140,6 +127,25 @@ class divListOGroup extends MultiSelectWindow // Assigning ogroups foreach($list as $key => $val){ + $acl= get_permissions ($val['dn'], $this->ui->subtreeACL); + $acl= get_module_permission($acl, "ogroup", $val['dn']); + + /* Create action icons */ + $actions = ""; + if($this->parent->CopyPasteHandler && $acl == "#all#"){ + $actions.= " "; + $actions.= " "; + } + $actions.= ""; + + if(chkacl($acl,"delete") == ""){ + $actions.= ""; + } + if(isset($val['mail'])){ $mail = $mailimg; }else{ diff --git a/plugins/admin/ogroups/class_mailogroup.inc b/plugins/admin/ogroups/class_mailogroup.inc index 560e4653c..3dd55699d 100644 --- a/plugins/admin/ogroups/class_mailogroup.inc +++ b/plugins/admin/ogroups/class_mailogroup.inc @@ -29,9 +29,16 @@ class mailogroup extends plugin /* Call parent execute */ plugin::execute(); + /* Do we need to flip is_account state? */ if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; + + /* Onyl change account state if allowed */ + if($this->is_account && $this->acl == "#all#"){ + $this->is_account= !$this->is_account; + }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){ + $this->is_account= !$this->is_account; + } } /* Show tab dialog headers */ diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc index 1f9b454ab..b5366a941 100644 --- a/plugins/admin/ogroups/class_ogroup.inc +++ b/plugins/admin/ogroups/class_ogroup.inc @@ -110,7 +110,7 @@ class ogroup extends plugin $this->reload(); }else{ /* Delete objects from group */ - if (isset($_POST['delete_membership']) && isset($_POST['members'])){ + if (isset($_POST['delete_membership']) && isset($_POST['members']) && chkacl($this->acl,"gosaGroupObjects") == ""){ foreach ($_POST['members'] as $value){ $this->objects["$value"]= $this->memberList[$value]; unset ($this->memberList["$value"]); @@ -122,7 +122,7 @@ class ogroup extends plugin } /* Add objects to group */ - if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){ + if (isset($_POST['add_object_finish']) && isset($_POST['objects']) && chkacl($this->acl,"gosaGroupObjects") == ""){ foreach ($_POST['objects'] as $value){ $this->memberList["$value"]= $this->objects[$value]; $this->member["$value"]= $value; @@ -150,7 +150,7 @@ class ogroup extends plugin } /* Delete objects from group */ - if (isset($_POST['delete_membership']) && isset($_POST['members'])){ + if (isset($_POST['delete_membership']) && isset($_POST['members']) && chkacl($this->acl,"gosaGroupObjects") == ""){ foreach ($_POST['members'] as $value){ if(isset($this->memberList[$value])){ $this->objects["$value"]= $this->memberList[$value]; @@ -183,7 +183,7 @@ class ogroup extends plugin /* Base select dialog */ $once = true; foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once){ + if(preg_match("/^chooseBase/",$name) && $once && chkacl($this->acl,"base") == ""){ $once = false; $this->dialog = new baseSelectDialog($this->config); $this->dialog->setCurrentBase($this->base); @@ -206,7 +206,7 @@ class ogroup extends plugin } /* Add objects? */ - if (isset($_POST["edit_membership"])){ + if (isset($_POST["edit_membership"]) && chkacl($this->acl,"gosaGroupObjects") == ""){ $this->group_dialog= TRUE; $this->dialog= TRUE; } @@ -271,10 +271,9 @@ class ogroup extends plugin } /* Bases / Departments */ - - if (isset($_POST['base'])){ - $this->base= $_POST['base']; - } + if (isset($_POST['base']) && chkacl($this->acl,"base") == ""){ + $this->base= $_POST['base']; + } /* Assemble combine string */ if ($this->gosaGroupObjects == "[]"){ @@ -338,7 +337,6 @@ class ogroup extends plugin if (chkacl ($this->acl, "base") == "" && isset($_POST["base"])){ $this->base= $_POST["base"]; } - } } @@ -609,7 +607,7 @@ class ogroup extends plugin $ui= get_userinfo(); $acl= get_permissions ($new_dn, $ui->subtreeACL); $acl= get_module_permission($acl, "group", $new_dn); - if (chkacl($acl, "create") != ""){ + if (chkacl($acl, "create") != "" && $this->dn=="new"){ $message[]= _("You have no permissions to create a group on this 'Base'."); } diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc index 09fba6b17..a0a981e64 100644 --- a/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/plugins/admin/ogroups/class_ogroupManagement.inc @@ -114,10 +114,34 @@ class ogroupManagement extends plugin /* Only perform copy / paste if it is enabled */ - /* Display the copy & paste dialog, if it is currently open */ - $ret = $this->copyPasteHandling($s_action,$s_entry); - if($ret){ - return($ret); + + /******************** + Copy & Paste Handling ... + ********************/ + + /* Only perform copy&paste requests if it is enabled + */ + /* Get 'dn' from posted 'uid' */ + if(in_array_ics($s_action,array("editPaste","cut","copy"))){ + + if(isset($this->ogrouplist[trim($s_entry)]['dn'])){ + $dn= $this->ogrouplist[trim($s_entry)]['dn']; + }else{ + $dn = $this->DivListOGroup->selectedBase; + } + + $acl= get_permissions ($dn, $this->ui->subtreeACL); + $acl= get_module_permission($acl, "ogroup", $dn); + + if($acl != "#all#"){ + print_red (_("You are not allowed to execute this method!")); + }else{ + /* Display the copy & paste dialog, if it is currently open */ + $ret = $this->copyPasteHandling($s_action,$s_entry); + if($ret){ + return($ret); + } + } } /**************** diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc index 2a2b1ad9c..7e712a4a0 100644 --- a/plugins/admin/ogroups/class_phonequeue.inc +++ b/plugins/admin/ogroups/class_phonequeue.inc @@ -196,7 +196,13 @@ class phonequeue extends plugin /* Do we need to flip is_account state? */ if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; + + /* Onyl change account state if allowed */ + if($this->is_account && $this->acl == "#all#"){ + $this->is_account= !$this->is_account; + }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){ + $this->is_account= !$this->is_account; + } } /* Show tab dialog headers */ @@ -767,10 +773,12 @@ class phonequeue extends plugin plugin::save_object(); if(isset($_POST['phonenumber'])){ foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_h","goFonDialOption_r","goFonDialOption_H","goFonMusiconHold") as $val){ - if(isset($_POST[$val])){ - $this->$val = $_POST[$val]; - }else{ - $this->$val = false; + if(chkacl($this->acl,$val) == "") { + if(isset($_POST[$val])){ + $this->$val = $_POST[$val]; + }else{ + $this->$val = false; + } } } if(isset($_POST['goFonQueueAnnounceHoldtime'])){ diff --git a/plugins/admin/ogroups/class_termgroup.inc b/plugins/admin/ogroups/class_termgroup.inc index 03d76d20a..4b2e74695 100644 --- a/plugins/admin/ogroups/class_termgroup.inc +++ b/plugins/admin/ogroups/class_termgroup.inc @@ -202,7 +202,7 @@ class termgroup extends plugin $names.= "$cn "; } - if (isset($_POST['action'])){ + if (isset($_POST['action']) && $this->acl == "#all#"){ /* Update members fai state */ $this->update_term_member_FAIstate(trim($_POST['saction'])); @@ -227,12 +227,12 @@ class termgroup extends plugin ***************/ /* Add new ntp Server to our list */ - if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers']))){ + if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl == "#all#"){ $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers']; } /* Delete selected NtpServer for list of used servers */ - if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected']))){ + if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl == "#all#"){ foreach($_POST['gotoNtpServerSelected'] as $name){ unset($this->gotoNtpServer[$name]); } diff --git a/plugins/admin/ogroups/phonequeue.tpl b/plugins/admin/ogroups/phonequeue.tpl index 02e671f0f..cdd9e7184 100644 --- a/plugins/admin/ogroups/phonequeue.tpl +++ b/plugins/admin/ogroups/phonequeue.tpl @@ -37,7 +37,7 @@ {$must} - {html_options options=$goFonHomeServers selected=$goFonHomeServer} -- 2.30.2