From 88a04884864ebe555a04f66e4761c2961591492e Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 26 Oct 2006 07:59:00 +0000 Subject: [PATCH] Completed conference acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4945 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../conference/class_divListConferences.inc | 48 ++++++++++++++----- .../class_phoneConferenceGeneric.inc | 23 ++++++--- .../class_phoneConferenceManagment.inc | 43 ++++++++++------- 3 files changed, 78 insertions(+), 36 deletions(-) diff --git a/plugins/gofon/conference/class_divListConferences.inc b/plugins/gofon/conference/class_divListConferences.inc index 9e0389ea9..339d561ae 100755 --- a/plugins/gofon/conference/class_divListConferences.inc +++ b/plugins/gofon/conference/class_divListConferences.inc @@ -67,14 +67,30 @@ class divListConference 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("gofon"); + $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/conference"); + /* NEW LIST MANAGMENT */ $listhead = "
". "  ". "  ". - "  ". - "  ". - "  "; - $listhead .= $this->get_snapshot_header($this->selectedBase); + title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> "; + + /* Only display create new conference if we are allowed to create new confe... */ + if(preg_match("/c/",$acls)){ + $listhead .="  ". + "  ". + "  "; + } + + /* Only display snapshot settings if we are able to write && create new entries */ + if(preg_match("/[cw]/",$acls)){ + $listhead .= $this->get_snapshot_header($this->selectedBase); + } + + /* Add the rest (base select ....)*/ $listhead .= _("Base")." ". "  ". diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index fc444e5ca..ef9f91ca1 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -138,7 +138,7 @@ class conference extends plugin $once = true; foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once){ + if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){ $once = false; $this->dialog = new baseSelectDialog($this->config,$this); $this->dialog->setCurrentBase($this->base); @@ -202,14 +202,23 @@ class conference extends plugin /* Save data to object */ function save_object() { - plugin::save_object(); if(isset($_POST['cn'])){ + + plugin::save_object(); + foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s", - "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D","goFonPIN") as $attrs){ - if(isset($_POST[$attrs])){ - $this->$attrs = $_POST[$attrs]; - }else{ - $this->$attrs = false; + "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){ + + /* Acl can't contain _ so we remove it here. */ + $acl_name = preg_replace("/_/","",$attrs); + + /* Attribute writeable ? */ + if($this->acl_is_writeable($acl_name)){ + if(isset($_POST[$attrs])){ + $this->$attrs = $_POST[$attrs]; + }else{ + $this->$attrs = false; + } } } } diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc index 5f55d2aae..58ee81d32 100644 --- a/plugins/gofon/conference/class_phoneConferenceManagment.inc +++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc @@ -118,17 +118,21 @@ class phoneConferenceManagment extends plugin * The entry which will be deleted is defined in $s_entry */ if ($s_action =="del"){ - $this->dn= $this->conferences[$s_entry]['dn']; - /* Check locking */ - if (($conf= get_lock($this->dn)) != ""){ - $_SESSION['dn']= $this->dn; - return(gen_locked_message($conf, $this->dn)); - } else { - add_lock ($this->dn, $this->ui->dn); - $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn)); - $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE)); - return ($display); + $acl = $this->ui->get_permissions($this->conferences[$s_entry]['dn'],"gofon/conference"); + if(preg_match("/d/",$acl)){ + $this->dn= $this->conferences[$s_entry]['dn']; + + /* Check locking */ + if (($conf= get_lock($this->dn)) != ""){ + $_SESSION['dn']= $this->dn; + return(gen_locked_message($conf, $this->dn)); + } else { + add_lock ($this->dn, $this->ui->dn); + $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn)); + $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE)); + return ($display); + } } } @@ -140,9 +144,8 @@ class phoneConferenceManagment extends plugin /* If department deletion is accepted ... * Finally delete department */ - $acl = $this->ui->get_permissions($this->dn,"gofon/conference"); if (isset($_POST['delete_department_confirm'])){ - echo "What the hell is going on here ? Huh ?!!"; + $acl = $this->ui->get_permissions($this->dn,"gofon/conference"); if(preg_match("/d/",$acl)){ $this->remove_from_parent(); gosa_log ("Department object'".$this->dn."' has been removed"); @@ -183,12 +186,16 @@ class phoneConferenceManagment extends plugin /* Insert new entry*/ if($s_action == "new" ){ - - /* Set up the users ACL's for this 'dn' */ - $this->dn= "new"; - $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn,"gofon"); - $this->conftab->set_acl_base("cn=dummy,ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase); - unset($_SESSION['objectinfo']); + + $dummy_dn = "cn=dummy,ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase; + $acl = $this->ui->get_permissions($dummy_dn,"gofon/conference"); + if(preg_match("/c/",$acl)){ + /* Set up the users ACL's for this 'dn' */ + $this->dn= "new"; + $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn,"gofon"); + $this->conftab->set_acl_base($dummy_dn); + unset($_SESSION['objectinfo']); + } } -- 2.30.2