Code

Inital acl fixed for conferences
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Oct 2006 06:08:16 +0000 (06:08 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Oct 2006 06:08:16 +0000 (06:08 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4943 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/conference/class_phoneConferenceGeneric.inc
plugins/gofon/conference/class_phoneConferenceManagment.inc
plugins/gofon/conference/generic.tpl
plugins/gofon/conference/main.inc

index 1e9340b23ecff51557c265f922877ceb9f6d22b5..18878127db5b04cc383e26a570cf776db76a51e1 100644 (file)
@@ -84,9 +84,6 @@ class conference extends plugin
       $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
     }
 
-    $ui= get_userinfo();
-    $acl= get_permissions ($ui->dn, $this->ui->subtreeACL);
-    $this->acl= get_module_permission($acl, "conference", $ui->dn);
     $this->goFonConferenceOwner=$this->ui->dn;
 
     /* Parse Options ... 
@@ -118,8 +115,26 @@ class conference extends plugin
 
     $smarty= get_smarty();
 
-    $smarty->assign("bases" ,$this->config->idepartments);
-    $smarty->assign("base"  ,$this->base);
+    /* Assign base ACL */
+    $baseACL = $this->getacl("base");
+    if(!$this->acl_is_moveable()) {
+      $baseACL = preg_replace("/w/","",$baseACL);
+    }
+    $smarty->assign("baseACL",          $baseACL);
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    if($this->acl_is_writeable("base")){
+      $smarty->assign("baseSelect",true);
+    }else{
+      $smarty->assign("baseSelect",false);
+    }
+
+    $smarty->assign("bases" ,$this->get_allowed_bases());
+    $smarty->assign("base_select"  ,$this->base);
 
     $once = true; 
     foreach($_POST as $name => $value){
@@ -151,7 +166,6 @@ class conference extends plugin
 
     foreach ($this->attributes as $val){
       $smarty->assign("$val", $this->$val);
-      $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
       if(!$this->$val){
         $smarty->assign($val."CHK", "");
       }else{
@@ -161,11 +175,11 @@ class conference extends plugin
 
     if($_SESSION['js']==1){
       if($this->goFonConferenceOption_P != "P"){
-        $smarty->assign("goFonPINACL"," disabled ");
+        $smarty->assign("goFonPINACL", $this->getacl("goFonPIN",TRUE));
         $smarty->assign("goFonPIN","");
       }
       if($this->goFonConferenceOption_r != "r"){
-        $smarty->assign("goFonConferenceOptionFormatACL"," disabled ");
+        $smarty->assign("goFonConferenceOptionFormatACL", $this->getacl("goFonConferenceOptionr",TRUE));
       }
     }
     return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
@@ -486,12 +500,6 @@ class conference extends plugin
 
     unset($this->attrs['base']);
 
-    foreach($this->attributes as $atr){
-      if(chkacl($this->acl, $atr)!=""){
-        unset($this->attrs[$atr]);
-      }
-    }
-
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
     $ldap->cat($this->dn, array('dn'));
@@ -518,7 +526,7 @@ class conference extends plugin
   function plInfo()
   {
     return (array(
-          "plShortName"   => _("Phone conferences"),
+          "plShortName"   => _("Conference"),
           "plDescription" => _("Phone conference management"),
           "plSelfModify"  => TRUE,
           "plDepends"     => array(),
@@ -528,17 +536,18 @@ class conference extends plugin
                                                   "objectClass" => "gofonConference")),
 
           "plProvidedAcls" => array(
+            "cn"                            => _("Name"),
             "base"                          => _("Base"), 
             "description"                   => _("Description"), 
             "goFonPIN"                      => _("Conference PIN"),
 
-            "goFonConferenceOption_P"       => _("Preset PIN"),
-            "goFonConferenceOption_r"       => _("Record conference"),
-            "goFonConferenceOption_M"       => _("Play music on hold"),
-            "goFonConferenceOption_s"       => _("Activate menu"),
-            "goFonConferenceOption_i"       => _("Announce user activity"),
-            "goFonConferenceOption_c"       => _("Count user"),
-            "goFonConferenceOption_D"       => _("Conference type"),
+            "goFonConferenceOptionP"       => _("Preset PIN"),
+            "goFonConferenceOptionr"       => _("Record conference"),
+            "goFonConferenceOptionM"       => _("Play music on hold"),
+            "goFonConferenceOptions"       => _("Activate menu"),
+            "goFonConferenceOptioni"       => _("Announce user activity"),
+            "goFonConferenceOptionc"       => _("Count user"),
+            "goFonConferenceOptionD"       => _("Conference type"),
 
             "goFonConferenceOptionFormat"   => _("Format"),
             "goFonConferenceOptionLifetime" => _("Lifetime"),
index 1bfb9b2f855db89b3ec8880d3a531812608d6bdb..5f2ade7291218fcf84733fb225482e5015a30b37 100644 (file)
@@ -36,19 +36,15 @@ class phoneConferenceManagment extends plugin
 
   var $conferences                       = array();
   var $conftab            = false;
-
+  var $ui                 = NULL;
   var $DivListConference  = NULL;
 
   /* Initialise Class */
   function phoneConferenceManagment ($config, $ui)
   {
-    $this->ui                  = $ui;
-    $this->dn                  = "";
+    $this->ui                    = $ui;
+    $this->dn                    = "";
     $this->config              = $config;
-
-    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
-    $this->acl= get_module_permission($acl, "conference", $ui->dn);
-
     $this->DivListConference = new divListConference($this->config,$this);
   }
 
@@ -144,8 +140,10 @@ 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'])){
-      if (chkacl($this->acl, "delete") == ""){
+      echo "What the hell is going on here ? Huh ?!!";
+      if(preg_match("/d/",$acl)){
         $this->remove_from_parent();
         gosa_log ("Department object'".$this->dn."' has been removed");
       } else {
@@ -173,7 +171,9 @@ class phoneConferenceManagment extends plugin
       add_lock ($this->dn, $this->ui->dn);
 
       /* Register conftab to trigger edit dialog */
-      $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn);
+      $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;
     }
 
@@ -183,11 +183,13 @@ class phoneConferenceManagment extends plugin
      ***************/
   
     /* Insert new entry*/    
-    if($s_action == "new"){
+    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);
+      $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);
       unset($_SESSION['objectinfo']);
     }
 
@@ -304,7 +306,11 @@ class phoneConferenceManagment extends plugin
 
   function remove_from_parent()
   {
+    /* Ehm what are we doinf here ? */
+  
     $cfg = new conference($this->config, $this->dn);
+    $cfg->set_acl_category("gofon");
+    $cfg->set_acl_base($this->dn);
 
     $cfg->remove_from_parent();
     $ldap= $this->config->get_ldap_link();
index f7b25a2d221bf6ab090994424f1cf26f0f26c974..75548aca23d2e799d6893302724b7f1535b02b4b 100644 (file)
 <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
- <td colspan=3>
-<h2 style='margin:0px; padding:0px;'><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Properties{/t}</h2>
- </td>
-</tr>
-<tr>
-<td style="vertical-align:top">
-       <table summary="">
-       <tr>
-       <td>
-       <LABEL for="cn">
-       {t}Conference name{/t}
-       </LABEL>
-       {$must}
-       </td>
-       <td>
-       <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of conference to create{/t}" {$cnACL}>
-       </td>
-       </tr>
-       <tr>
-       <td><LABEL for="goFonConferenceOption_D">{t}Type{/t}</LABEL>{$must}</td>
-       <td>
-       <select id="goFonConferenceOption_D" size="1" name="goFonConferenceOption_D" title="{t}Choose subtree to place conference in{/t}" {$goFonConferenceOption_DACL}> 
-       {html_options options=$goFonConferenceOptions selected=$goFonConferenceOption_D}
-       </select>
-       </td>
-       </tr>
-       <tr>
-       <td colspan="2"><br></td>
-       </tr>
-       <tr>
-       <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-       <td>
-       <select id="base" size="1" name="base" title="{t}Choose subtree to place conference in{/t}" {$baseACL}> 
-       {html_options options=$bases selected=$base}
-       </select>
-        {if $baseACL == ""}
+  <tr>
+    <td colspan=3>
+      <h2 style='margin:0px; padding:0px;'><img class="center" alt="" align="middle" src="images/rightarrow.png"> 
+        {t}Properties{/t}
+      </h2>
+    </td>
+  </tr>
+  <tr>
+    <td style="vertical-align:top">
+       <table summary="">
+        <tr>
+          <td>
+            <LABEL for="cn">
+              {t}Conference name{/t}
+            </LABEL>
+            {$must}
+          </td>
+          <td>
+{render acl=$cnACL}
+            <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of conference to create{/t}">
+{/render}
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <LABEL for="goFonConferenceOption_D">
+              {t}Type{/t}
+            </LABEL>
+            {$must}
+          </td>
+          <td>
+{render acl=$goFonConferenceOptionDACL}
+            <select id="goFonConferenceOption_D" size="1" name="goFonConferenceOption_D" 
+              title="{t}Choose subtree to place conference in{/t}"> 
+              {html_options options=$goFonConferenceOptions selected=$goFonConferenceOption_D}
+            </select>
+{/render} 
+          </td>
+        </tr>
+        <tr>
+          <td colspan="2">
+            <br>
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <LABEL for="base">
+              {t}Base{/t}
+            </LABEL>
+            {$must}
+          </td>
+          <td>
+
+{render acl=$baseACL}
+            <select id="base" size="1" name="base" title="{t}Select a base{/t}">
+              {html_options options=$bases selected=$base_select}
+            </select>
+{/render}
+
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
             <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-        {else}
-            <img src="images/folder_gray.png" class="center" title="{t}Select a base{/t}">
-        {/if}
-       </td>
-       </tr>
-       </table>
+{/render}
+
+          </td>
+        </tr>
+      </table>
+
+    </td>
+    <td style="border-left:1px solid #A0A0A0">
+      &nbsp;
+    </td>
+    <td width="50%">
+      <table summary="">
+        <tr>
+          <td>
+            <LABEL for="description">
+              {t}Description{/t}
+            </LABEL>
+          </td>
+          <td>
+{render acl=$descriptionACL}
+            <input id="description" name="description" size=40 maxlength=80  
+              value="{$description}" title="{t}Descriptive text for department{/t}">
+{/render} 
+          </td>
+        </tr>
+        <tr>
+          <td>
+            {t}Lifetime (in days){/t}
+          </td>
+          <td>
+{render acl=$goFonConferenceOptionLifetimeACL}
+            <input name="goFonConferenceOptionLifetime" size=15 value="{$goFonConferenceOptionLifetime}">
+{/render} 
+          </td>
+        </tr>
+        <tr>
+          <td>
+            {t}Phone number{/t}
+            {$must}
+          </td>
+          <td>
+{render acl=$telephoneNumberACL}
+            <input name="telephoneNumber" value="{$telephoneNumber}" size=15>
+{/render} 
+          </td>
+        </tr>
+      </table>
 
-</td>
-<td style="border-left:1px solid #A0A0A0">
-     &nbsp;
-</td>
-<td width="50%">
-       <table summary="">
-       <tr>
-       <td>
-       <LABEL for="description">
-       {t}Description{/t}
-       </LABEL>
-       </td>
-       <td>
-       <input id="description" name="description" size=40 maxlength=80 {$descriptionACL} 
-       value="{$description}" title="{t}Descriptive text for department{/t}">
-       </td>
-       </tr>
-       <tr>
-       <td>
-       {t}Lifetime (in days){/t}
-       </td>
-       <td>
-       <input name="goFonConferenceOptionLifetime" size=15 value="{$goFonConferenceOptionLifetime}" {$goFonConferenceOptionLifetimeACL}>
-       </td>
-       </tr>
-       <tr>
-       <td>
-       {t}Phone number{/t}
-       {$must}
-       </td>
-       <td>
-       <input name="telephoneNumber" value="{$telephoneNumber}" size=15 {$telephoneNumberACL}>
-       </td>
-       </tr>
-       </table>
+    </td>
+  </tr>
+  <tr>
+    <td colspan=3 style='width:100%;'>
+      <p class='seperator'>&nbsp;</p>
+    </td>
+  </tr>
+  <tr>
+    <td colspan=3>
+      <h2 style='margin:0px; padding:0px;'><img class="center" alt="" align="middle" src="images/select_ogroup.png"> 
+        {t}Options{/t}
+      </h2>
+    </td>
+  </tr>
+  <tr>
+    <td>
 
-</td>
-</tr>
-<tr>
-<td colspan=3 style='width:100%;'>
-       <p class='seperator'>&nbsp;</p>
-</td>
-</tr>
-<tr>
- <td colspan=3>
-<h2 style='margin:0px; padding:0px;'><img class="center" alt="" align="middle" src="images/select_ogroup.png"> {t}Options{/t}</h2>
- </td>
-</tr>
-<tr>
-<td>
+           <table summary="">
+        <tr>
+               <td>
+{render acl=$goFonConferenceOptionPACL}
+                       <input type="checkbox" onclick="changeState('goFonPIN');" name="goFonConferenceOption_P" 
+                                           value="P" {$goFonConferenceOption_PCHK}> 
+{/render} 
+               </td>
+          <td>
+                       {t}Preset PIN{/t}
+               </td>
+             </tr>
+             <tr>
+               <td>
+                 &nbsp;
+               </td>
+               <td>
+                       {t}PIN{/t} 
+{render acl=$goFonPINACL}
+            <input type='password' name="goFonPIN" id="goFonPIN" value="{$goFonPIN}" title="{$goFonPIN}">
+{/render} 
+               </td>
+             </tr>
+        <tr>
+               <td colspan=2>
+{render acl=$goFonConferenceOptionrACL}
+                       <input type="checkbox" onclick="changeState('goFonConferenceOptionFormat');" name="goFonConferenceOption_r" 
+              value="r" {$goFonConferenceOption_rCHK}> 
+{/render} 
+             {t}Record conference{/t}
+               </td>
+             </tr>
+             <tr>
+               <td>
+                 &nbsp;
+               </td>
+               <td>
+                 {t}Sound file format{/t}&nbsp;
+{render acl=$goFonConferenceOptionFormatACL}
+                 <select id="goFonConferenceOptionFormat" size="1" name="goFonConferenceOptionFormat" 
+              title="{t}Choose subtree to place department in{/t}"> 
+                   {html_options options=$goFonConferenceOptionFormats selected=$goFonConferenceOptionFormat}
+               </select>
+{/render} 
+               </td>
+             </tr>
+           </table>
 
-       <table summary="">
-    <tr>
-       <td>
-               <input type="checkbox" onclick="changeState('goFonPIN');" name="goFonConferenceOption_P" 
-                                       value="P" {$goFonConferenceOption_PCHK} {$goFonConferenceOption_PACL}> 
-       </td><td>
-               {t}Preset PIN{/t}
-       </td>
-       </tr>
-       <tr>
-       <td>
-        &nbsp;
-       </td>
-       <td>
-               {t}PIN{/t} <input type='password' name="goFonPIN" {$goFonPINACL} id="goFonPIN" value="{$goFonPIN}" title="{$goFonPIN}">
-       </td>
-       </tr>
-    <tr>
-       <td colspan=2>
-               <input type="checkbox" onclick="changeState('goFonConferenceOptionFormat');" name="goFonConferenceOption_r" value="r" {$goFonConferenceOption_rCHK} {$goFonConferenceOption_rACL}> 
-       {t}Record conference{/t}
-       </td>
-       </tr>
-       <tr>
-       <td>
-       &nbsp;
-       </td>
-       <td>
-       {t}Sound file format{/t}&nbsp;
-       <select id="goFonConferenceOptionFormat" size="1" name="goFonConferenceOptionFormat" {$goFonConferenceOptionFormatACL} title="{t}Choose subtree to place department in{/t}"> 
-       {html_options options=$goFonConferenceOptionFormats selected=$goFonConferenceOptionFormat}
-       </select>
-       </td>
-       </tr>
-       </table>
+    </td>
+    <td style="border-left:1px solid #A0A0A0">
+      &nbsp;
+         </td>
+    <td>
 
-</td>
-  <td style="border-left:1px solid #A0A0A0">
-     &nbsp;
-          </td>
-<td>
-       <table summary="">
-       <tr>
-       <td>
-               <input type="checkbox" name="goFonConferenceOption_M" value="M" {$goFonConferenceOption_MCHK} {$goFonConferenceOption_MACL}> 
-               {t}Play music on hold{/t}
-       </td>
-       </tr>
-       <tr>
-       <td>
-               <input type="checkbox" name="goFonConferenceOption_s" value="s" {$goFonConferenceOption_sCHK} {$goFonConferenceOption_sACL}> 
-               {t}Activate session menu{/t}
-       </td>
-       </tr>
-       <tr>
-       <td>
-               <input type="checkbox" name="goFonConferenceOption_i" value="i" {$goFonConferenceOption_iCHK} {$goFonConferenceOption_iACL}> 
-               {t}Announce users joining or leaving the conference{/t}
-       </td>
-       </tr>
-       <tr>
-       <td>
-               <input type="checkbox" name="goFonConferenceOption_c" value="c" {$goFonConferenceOption_cCHK} {$goFonConferenceOption_cACL}> 
-               {t}Count users{/t}
-       </td>
-       </tr>
-       </table>
+      <table summary="">
+        <tr>
+          <td>
+{render acl=$goFonConferenceOptionMACL}
+            <input type="checkbox" name="goFonConferenceOption_M" value="M" {$goFonConferenceOption_MCHK}> 
+{/render} 
+            {t}Play music on hold{/t}
+          </td>
+        </tr>
+        <tr>
+          <td>
+{render acl=$goFonConferenceOptionsACL}
+            <input type="checkbox" name="goFonConferenceOption_s" value="s" {$goFonConferenceOption_sCHK}> 
+{/render} 
+            {t}Activate session menu{/t}
+          </td>
+        </tr>
+        <tr>
+          <td>
+{render acl=$goFonConferenceOptioniACL}
+            <input type="checkbox" name="goFonConferenceOption_i" value="i" {$goFonConferenceOption_iCHK}> 
+{/render} 
+            {t}Announce users joining or leaving the conference{/t}
+         </td>
+        </tr>
+        <tr>
+          <td>
+{render acl=$goFonConferenceOptioncACL}
+            <input type="checkbox" name="goFonConferenceOption_c" value="c" {$goFonConferenceOption_cCHK}>
+{/render} 
+            {t}Count users{/t}
+          </td>
+        </tr>
+      </table>
 
-</td>
-</tr>
+    </td>
+  </tr>
 </table>
 
 <!-- Place cursor -->
   document.mainform.cn.focus();
   -->
 </script>
+<!-- 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: 
+-->
index fd3ea7ef83abcce1bf7348b5d7323e42173831d9..d75fc78d9b9d513948f45d14467fc5006ff56d95 100644 (file)
@@ -41,9 +41,6 @@ if ($remove_lock){
                $display= print_header(get_template_path('images/conference.png'), _("Conference management"));
        }
 
-       $acl= get_permissions ($ui->dn, $ui->subtreeACL);
-    $conference->acl= get_module_permission($acl, "conference", $ui->dn);
-
        /* Reset requested? */
        if (isset($_GET['reset']) && $_GET['reset'] == 1){
                del_lock ($ui->dn);