Code

some updates for acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Oct 2006 07:27:25 +0000 (07:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Oct 2006 07:27:25 +0000 (07:27 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4944 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/conference/class_divListConferences.inc
plugins/gofon/conference/class_phoneConferenceGeneric.inc
plugins/gofon/conference/class_phoneConferenceManagment.inc
plugins/gofon/conference/tabs_conference.inc

index 37912ed17a2060cc2f734aec7ef07a9604a8dbdf..9e0389ea9170171602f2e3dccc4e6017f3129c42 100755 (executable)
@@ -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= "<input class='center' type='image' src='images/edit.png'     
-        alt='"._("edit")."'    name='conf_edit_%KEY%' title='"._("Edit this entry")."'>";
-      $actions.= $this->GetSnapShotActions($conference['dn']);
-      $actions.= "<input class='center' type='image' src='images/edittrash.png' 
-        alt='"._("delete")."'   name='conf_del_%KEY%'  title='"._("Delete this entry")."'>";
-      $actions2= "<input class='center' type='image' src='images/edittrash.png' 
-        alt='"._("delete")."'   name='conf_del_%KEY%'  title='"._("Delete this entry")."'>";
-
-      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.= "<input class='center' type='image' src='images/edittrash.png' 
+          alt='"._("delete")."'   name='conf_del_%KEY%'  title='"._("Delete this entry")."'>";
+      }
+
+      /* 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 = "<img class='center' src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
       }else{
         $pin = "&nbsp;";
       }
 
-      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 = "&nbsp; - ?";
       }
 
+      /* 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("/ /","&nbsp;",@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"=>"&nbsp;", "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));
     }
index 18878127db5b04cc383e26a570cf776db76a51e1..fc444e5cabdc87138c41ae0ce7fc27711c3795ef 100644 (file)
@@ -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;
index 5f2ade7291218fcf84733fb225482e5015a30b37..5f55d2aaecceac6270284a7b55e0a63f6ad4dcee 100644 (file)
@@ -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']);
     }
 
index b588ee4d2ad550d909f835b95ba6f8c81cd7e929..7db12cf3505286d9fc38313c9438fdb589aee556 100644 (file)
@@ -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 */