From de0f845c212eaeee9bb144c3f118e31fa832cfc9 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 26 Oct 2006 07:27:25 +0000 Subject: [PATCH] some updates for acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4944 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../conference/class_divListConferences.inc | 61 +++++++++++-------- .../class_phoneConferenceGeneric.inc | 2 +- .../class_phoneConferenceManagment.inc | 4 +- plugins/gofon/conference/tabs_conference.inc | 4 +- 4 files changed, 40 insertions(+), 31 deletions(-) diff --git a/plugins/gofon/conference/class_divListConferences.inc b/plugins/gofon/conference/class_divListConferences.inc index 37912ed17..9e0389ea9 100755 --- a/plugins/gofon/conference/class_divListConferences.inc +++ b/plugins/gofon/conference/class_divListConferences.inc @@ -120,54 +120,65 @@ class divListConference extends MultiSelectWindow /* Insert conferneces*/ foreach($list as $conferencekey => $conference ){ + $acl = $this->ui -> get_permissions($conference['dn'],"gofon/conference"); + + /* You will need at least read access for the + current conference informations to display it */ + if(!preg_match("/r/",$acl)){ + continue; + } + + /* Add edit icon - This is allowed when we have at least read access. */ $actions= ""; - $actions.= $this->GetSnapShotActions($conference['dn']); - $actions.= ""; - $actions2= ""; - - if((isset($conference['goFonPIN'][0]))&&(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])||($this->parent->acl=="#all#"))){ + alt='"._("edit")."' name='conf_edit_%KEY%' title='"._("Edit this entry")."'>"; + + /* Add snapshot icon - This is allowed when we have create and write access for the current entry */ + if(preg_match("/[cw]/",$acl)){ + $actions.= $this->GetSnapShotActions($conference['dn']); + } + + /* Create delete link - Only if we are allowed to delete this entry */ + if(preg_match("/d/",$acl)){ + $actions.= ""; + } + + /* Display PIN icon, only if we are the owner of the given conference */ + $owner = $this->parent->ui->dn==$conference['goFonConferenceOwner'][0]; + $p_acl = $this->ui->get_permissions($conference['dn'],"gofon/conference","goFonPIN"); + if((isset($conference['goFonPIN'][0])) && $owner && preg_match("/r/",$p_acl)){ $pin = "PIN"; }else{ $pin = " "; } - if(isset($conference['telephoneNumber'][0])){ + /* Display numer of the conference if we are allowed to view it */ + $n_acl = $this->ui->get_permissions($conference['dn'],"gofon/conference","telephoneNumber"); + if(isset($conference['telephoneNumber'][0]) && preg_match("/r/",$n_acl)){ $number = " - ".$conference['telephoneNumber'][0]; }else{ $number = "  - ?"; } + /* Get conference owner name */ $ldap= $this->parent->config->get_ldap_link(); $ldap->cat($conference['goFonConferenceOwner'][0], array('cn')); $data = $ldap->fetch(); if(isset($data['cn'][0])){ $cn = $data['cn'][0]; }else{ - $cn =""; + $cn = _("Unknown"); } + /* Create title */ $title = " title='".preg_replace("/ /"," ",@LDAP::fix($data['dn']))."' "; $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => $title." style='text-align:center;width:20px;'"); - - if(($this->parent->acl=="#all#")||(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")==""))){ - $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number), "attach" => $title." style=''"); - }else{ - $a_field2 = array("string"=>$conference['cn'][0].$number, "attach" => $title." style=''"); - } - $a_field3 = array("string"=> $cn, "attach" => $title." style='width:200px;'"); + $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number), "attach" => $title." style=''"); + $a_field3 = array("string"=> $cn , "attach" => $title." style='width:200px;'"); $a_field4 = array("string"=> $pin, "attach" => $title." style='width:50px;'"); - - if(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")=="")){ - $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions), "attach" => $title."style='width:".$action_col_size."px;border-right:0px;text-align:right;'"); - }elseif(chkacl($this->parent->acl,"goFonConferenceOwner")==""){ - $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$action.$actions2), "attach" => $title."style='width:52px;border-right:0px;text-align:right;'"); - }else{ - $a_field5 = array("string"=>" ", "attach" => $title."style='width:52px;border-right:0px;text-align:right;'"); - } + $a_field5 = array("string"=> preg_replace("/%KEY%/",$conferencekey,$actions), + "attach"=> $title."style='width:52px;border-right:0px;text-align:right;'"); $this->AddElement(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5)); } diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 18878127d..fc444e5ca 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -81,7 +81,7 @@ class conference extends plugin $this->base= dn2base($ui->dn); } } else { - $this->base= preg_replace ("/^[^,]+,/", "", $this->dn); + $this->base= preg_replace ("/^[^,]+,ou=conferences,ou=asterisk,ou=configs,ou=systems,/", "", $this->dn); } $this->goFonConferenceOwner=$this->ui->dn; diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc index 5f2ade729..5f55d2aae 100644 --- a/plugins/gofon/conference/class_phoneConferenceManagment.inc +++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc @@ -172,7 +172,6 @@ class phoneConferenceManagment extends plugin /* Register conftab to trigger edit dialog */ $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn,"gofon"); - $this->conftab->set_acl_category("gofon"); $this->conftab->set_acl_base($this->dn); $_SESSION['objectinfo']= $this->dn; } @@ -188,8 +187,7 @@ class phoneConferenceManagment extends plugin /* 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_category("gofon"); - $this->conftab->set_acl_base($this->DivListConference->selectedBase); + $this->conftab->set_acl_base("cn=dummy,ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase); unset($_SESSION['objectinfo']); } diff --git a/plugins/gofon/conference/tabs_conference.inc b/plugins/gofon/conference/tabs_conference.inc index b588ee4d2..7db12cf35 100644 --- a/plugins/gofon/conference/tabs_conference.inc +++ b/plugins/gofon/conference/tabs_conference.inc @@ -4,9 +4,9 @@ class conferencetabs extends tabs { var $base= ""; - function conferencetabs($config, $data, $dn) + function conferencetabs($config, $data, $dn, $category) { - tabs::tabs($config, $data, $dn); + tabs::tabs($config, $data, $dn,$category); $this->base= $this->by_object['conference']->base; /* Add references/acls/snapshots */ -- 2.30.2