Code

Made connectivity kolabAccount compatible with new acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 Jul 2006 04:23:28 +0000 (04:23 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 Jul 2006 04:23:28 +0000 (04:23 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4295 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/connectivity/class_kolabAccount.inc
plugins/personal/connectivity/kolab.tpl

index 85a9bd8da33a0656ce34a0c9889968a0cb548021..8fe31efabcb310f335f12cbdd9c64fd3d146cdcc 100644 (file)
@@ -18,7 +18,7 @@ class kolabAccount extends plugin
 
   /* Helper */
   var $imapping= array();
-
+  var $mail_Account   = false;
 
   function kolabAccount ($config, $dn= NULL)
   {
@@ -50,6 +50,13 @@ class kolabAccount extends plugin
         $this->is_account = true;
       }
     } 
+
+    /* Transfer account states for this union */
+    if (isset($this->parent) && $this->parent->by_object['mailAccount']->is_account){
+      $this->mail_Account = true;
+    } elseif($this-> initially_was_account && (isset($this->attrs['objectClass']) && (in_array("kolabInetOrgPerson",$this->attrs['objectClass'])))){
+      $this->mail_Account = true;
+    }
   }
 
 
@@ -67,9 +74,16 @@ class kolabAccount extends plugin
     /* Load attributes */
     foreach($this->attributes as $val){
       $smarty->assign("$val", $this->$val);
-      $smarty->assign($val."ACL", chkacl($this->acl, "$val"));
     }
-    $smarty->assign("kolabAccountACL", chkacl($this->acl, "kolabAccountACL"));
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $acl => $description){
+      $smarty->assign($acl."ACL",$this->getacl($acl));
+      $smarty->assign($acl."_W", $this->acl_is_writeable($acl));
+    }
+    $smarty->assign("is_account" ,  $this->is_account); 
+    $smarty->assign("is_removeable",$this->acl_is_removeable()); 
+    $smarty->assign("is_createable",$this->acl_is_createable()); 
 
     /* Check for invitation action */
     $nr= 0;
@@ -125,7 +139,7 @@ class kolabAccount extends plugin
 
         if ($valid){
           /* Add it */
-          if (chkacl ($this->acl, "kolabDelegate") == ""){
+          if ($this->acl_is_writeable("kolabDelegate")){
             $this->addDelegate ($address);
             $this->is_modified= TRUE;
           }
@@ -136,9 +150,7 @@ class kolabAccount extends plugin
 
     /* Delete forward email addresses */
     if (isset($_POST['delete_delegation'])){
-      if (count($_POST['delegate_list'])
-          && chkacl ($this->acl, "kolabDelegate") == ""){
-
+      if (count($_POST['delegate_list']) && $this->acl_is_writeable("kolabDelegate")){
         $this->delDelegate ($_POST['delegate_list']);
       }
     }
@@ -158,15 +170,6 @@ class kolabAccount extends plugin
       $smarty->assign('unrestrictedMailSizeState', "");
     }
 
-    /* Transfer account states for this union */
-    if (isset($this->parent) && $this->parent->by_object['mailAccount']->is_account){
-      $smarty->assign('mail_account', 'true');
-    } elseif($this-> initially_was_account && (isset($this->attrs['objectClass']) && (in_array("kolabInetOrgPerson",$this->attrs['objectClass'])))){
-      $smarty->assign('mail_account', 'true');
-    }else{
-      $smarty->assign('mail_account', '');
-    }
-
     /* Transfer delegation list */
     if (!count($this->kolabDelegate)){
       /* Smarty will produce <option value=""></option> and tidy don't like that, so tell smarty to create no option (array();)*/
@@ -174,26 +177,34 @@ class kolabAccount extends plugin
     } else {
       $smarty->assign("kolabDelegate", $this->kolabDelegate);
     }
-    $smarty->assign("kolabDelegateACL", chkacl($this->acl, $this->kolabDelegate));
+
+    $smarty->assign("mail_account",$this->mail_Account);
 
     /* Create InvitationPolicy table */
     $invitation= "";
     $this->imapping= array();
     $nr= 0;
-    $acl= chkacl($this->acl, "kolabInvitationPolicy");
-    $changeState = "";
+    $changeState  = "";
     foreach ($this->kolabInvitationPolicy as $entry){
 
-      $changeState .= "changeState('address".$nr."'); \n changeState('policy".$nr."'); \n
-                         changeState('add".$nr."'); \n changeState('remove".$nr."'); \n";
+      if($this->acl_is_writeable("kolabInvitationPolicy")){
+        $changeState .= "changeState('address".$nr."'); \n changeState('policy".$nr."'); \n
+          changeState('add".$nr."'); \n changeState('remove".$nr."'); \n";
+      }
 
-      $invitation.= "<tr><td>";
-      if($this->is_account){
-        $dis = " ";
-      }else{
+      if(!$this->acl_is_writeable("kolabInvitationPolicy")){
         $dis = " disabled ";
+      }else{
+        if($this->is_account){
+          $dis = " ";
+        }else{
+          $dis = " disabled ";
+        }
+      }
+      $invitation.= "<tr><td>";
+
+      if(!$this->acl_is_readable("kolabInvitationPolicy"))    {
       }
-    
 
       /* The default entry does not have colons... */
       if (!preg_match('/:/', $entry)){
@@ -203,6 +214,10 @@ class kolabAccount extends plugin
       } else {
         $name= preg_replace('/:.*$/', '', $entry);
         $mode= preg_replace('/^[^:]*: */', '', $entry);
+
+        if(!$this->acl_is_readable("kolabInvitationPolicy")){
+          $name='';
+        }
         $invitation.= "<input name=\"address$nr\" size=16 maxlength=60 $acl value=\"$name\" id='address".$nr."' ".$dis.">";
       }
       $invitation.= "</td>";
@@ -409,17 +424,18 @@ class kolabAccount extends plugin
           "plShortName"     => _("Kolab"),
           "plDescription"   => _("Kolab account settings"),
           "plSelfModify"    => TRUE,
-          "plDepends"       => array("connectivity"),
+          "plDepends"       => array("user"),
           "plPriority"      => 2,                                 // Position in tabs
           "plSection"       => "personal",                        // This belongs to personal
-          "plCategory"      => array("gosaAccount"),
+          "plCategory"      => array("users"),
           "plOptions"       => array(),
 
           "plProvidedAcls"  => array(
             "kolabFreeBusyFuture"   => _("Free busy future"),
             "unrestrictedMailSize"  => _("Mail size restriction"),
             "calFBURL"              => _("Free busy information"),
-            "kolabDelegate"         => _("Delegations"))
+            "kolabDelegate"         => _("Delegations"),
+            "kolabInvitationPolicy" => _("Invitation policy"))
           ));
   }
 }
index 56ef2bbc3cbc96f89b78eac31a495d051bf9b6ac..c2a0985357954746cb0a5527c84ba2d9ef1a35fc 100644 (file)
@@ -3,19 +3,35 @@
        <h2>{t}Kolab account{/t}</h2>
        {t}The kolab account is currently disabled. It's features can be adjusted if you add a mail account.{/t}
 {else}
+
+
+
 <input type="checkbox" id="kolabState" name="kolabState" value="1" {if $kolabState} checked {/if} 
+       {if (!$is_account && $is_createable) || ($is_account && $is_removeable)}
+       {else}
+               disabled        
+       {/if}
        onClick="
+       {if $kolabDelegate_W}
        changeState('delegate_list');
        changeState('delegate_address');
        changeState('add_delegation');
        changeState('delete_delegation');
+       {/if}
+       {if $unrestrictedMailSize_W}
        changeState('unrestrictedMailSize');
+       {/if}
+       {if $calFBURL_W}
        changeState('calFBURL');
+       {/if}
+       {if $kolabFreeBusyFuture_W}
        changeState('kolabFreeBusyFuture');
-       changeState('kolabInvitationPolicy');
-       {$changeState}"
-       {$kolabAccountACL}
->
+       {/if}
+       {if $kolabInvitationPolicy_W}
+       {$changeState}
+       {/if}">
+
+
 <b>{t}Kolab account{/t}</b>
 <br>
 <br>
  <tr>
   <td style="width:50%; vertical-align:top;">
    <b><LABEL for="delegate_list">{t}Delegations{/t}</LABEL></b><br>
+{render acl=$kolabDelegateACL}
    <select id="delegate_list" style="width:350px; height:100px;" name="delegate_list[]" size=15 multiple  {if !$kolabState} disabled {/if} >
     {html_options values=$kolabDelegate output=$kolabDelegate}
        <option disabled>&nbsp;</option>
    </select>
+{/render}
    <br>
-   <input name="delegate_address" size=30 align=middle maxlength=60 {if !$kolabState} disabled {/if}
-        {$kolabDelegateACL} value="" id="delegate_address">
-   <input type=submit value="{t}Add{/t}" name="add_delegation" {if !$kolabState} disabled {/if}
-        {$kolabDelegateACL} id="add_delegation">&nbsp;
-   <input type=submit value="{t}Delete{/t}" name="delete_delegation" {if !$kolabState} disabled {/if}
-        {$kolabDelegateACL} id="delete_delegation">
+{render acl=$kolabDelegateACL}
+   <input name="delegate_address" size=30 align=middle maxlength=60 {if !$kolabState} disabled {/if} value="" id="delegate_address">
+{/render}
+{render acl=$kolabDelegateACL}
+   <input type=submit value="{t}Add{/t}" name="add_delegation" {if !$kolabState} disabled {/if} id="add_delegation">&nbsp;
+{/render}
+{render acl=$kolabDelegateACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_delegation" {if !$kolabState} disabled {/if} id="delete_delegation">
+{/render}
    <p>
     <b>{t}Mail size{/t}</b><br>
+{render acl=$unrestrictedMailSizeACL}
      &nbsp;<input type="checkbox" id='unrestrictedMailSize' name="unrestrictedMailSize" value="1" {if !$kolabState} disabled {/if}
-       {$unrestrictedMailSizeACL} {$unrestrictedMailSizeState}> {t}No mail size restriction for this account{/t}
+       {$unrestrictedMailSizeState}> {t}No mail size restriction for this account{/t}
+{/render}
     </p>
   </td>
   <td rowspan=2 style="border-left:1px solid #A0A0A0">
  <table summary="">
   <tr>
    <td><LABEL for="calFBURL">{t}URL{/t}</LABEL></td>
-   <td><input id="calFBURL" name="calFBURL" size=30 maxlength=60 {$calFBURLACL} value="{$calFBURL}" {if !$kolabState} disabled {/if}></td>
+   <td>
+{render acl=$calFBURLACL}
+   <input id="calFBURL" name="calFBURL" size=30 maxlength=60 value="{$calFBURL}" {if !$kolabState} disabled {/if}>
+{/render}
+   </td>
   </tr>
   <tr>
   <td><LABEL for="kolabFreeBusyFuture">{t}Future{/t}</LABEL></td>
-   <td><input id="kolabFreeBusyFuture" name="kolabFreeBusyFuture" size=5 maxlength=6 i {if !$kolabState} disabled {/if}{$kolabFreeBusyFutureACL} value="{$kolabFreeBusyFuture}"> {t}days{/t}</td>
+  <td>
+{render acl=$kolabFreeBusyFutureACL}
+   <input id="kolabFreeBusyFuture" name="kolabFreeBusyFuture" size=5 maxlength=6 i {if !$kolabState} disabled {/if} value="{$kolabFreeBusyFuture}"> 
+       {t}days{/t}
+{/render}
+   </td>
   </tr>
  </table>
 
 
  <b>{t}Invitation policy{/t}</b><br>
  <table summary="">
+{render acl=$kolabInvitationPolicyACL}
    {$invitation}
+{/render}
  </table>
 
   </td>