Code

Updated sambaAccount
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 Jul 2008 13:12:46 +0000 (13:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 Jul 2008 13:12:46 +0000 (13:12 +0000)
- Do not display plugins save button if we have a dialog open.
- Fixed ACLs for sambaLogonHours.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11610 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/samba/personal/samba/class_sambaAccount.inc
gosa-plugins/samba/personal/samba/class_sambaLogonHours.inc
gosa-plugins/samba/personal/samba/main.inc
gosa-plugins/samba/personal/samba/sambaLogonHours.tpl

index d1389d8be80b00911a901860d302220aa7fc8019..ea8c8da32d0503e76eeace003648f89e2f905710 100644 (file)
@@ -250,7 +250,7 @@ class sambaAccount extends plugin
     $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
 
     /* Open Samaba Logong hours dialog */
-    if(isset($_POST['SetSambaLogonHours']) && $this->samba3 && $this->acl_is_writeable("sambaLogonHours")){
+    if(isset($_POST['SetSambaLogonHours']) && $this->samba3 && $this->acl_is_readable("sambaLogonHours")){
       $this->dialog = new sambaLogonHours($this->config,$this->dn,$this->sambaLogonHours);
     }
 
@@ -282,6 +282,10 @@ class sambaAccount extends plugin
       $smarty->assign($var."ACL",$this->getacl($var,$SkipWrite));
     }
 
+    if(!session::is_set('edit')){
+      $smarty->assign("sambaLogonHoursACL","");
+    }
+
     if ($this->sambaPwdMustChange=="0"){
       $date= getdate();
     } else {
index e3cc51d3466ecdbc7889d5bcf63f49a9bf9f91cb..d37cd2e64492db3e8c319b9c13fd61d600479391 100644 (file)
@@ -60,13 +60,16 @@ class sambaLogonHours extends plugin
 
     $week_days = msgPool::weekdays();
 
+    $ui =get_userinfo();
+    $smarty = get_smarty();
+    $acl = $ui->get_permissions($this->dn,"users/sambaAccount","sambaLogonHours");
+    $smarty->assign("acl",preg_match("/w/i",$acl));
+
     $hours = array();
     for($i = 0 ; $i <24 ; $i++ ){
       $hours[$i] = $i ;
     }
-    $ui =get_userinfo();
 
-    $smarty = get_smarty();
     $smarty->assign("Matrix",$this->Matrix);
     $smarty->assign("Days"  ,$week_days);
     $smarty->assign("Hours" ,$hours);
index 6eb885c7f91629e30340831064017fa29d8d1720..59f48fc2b4314e6b5e4c469253a915245c6c7e64 100644 (file)
@@ -96,7 +96,7 @@ if (!$remove_lock){
   }
 
   $info= "";
-  if (($sambaAccount->is_account) && (!$sambaAccount->show_ws_dialog) && empty($lock_msg)){
+  if (($sambaAccount->is_account) && (!$sambaAccount->dialog) && (!$sambaAccount->show_ws_dialog) && empty($lock_msg)){
     $display.= "<p class=\"plugbottom\">";
 
     /* Are we in edit mode? */
index 3f5ab3029b49907eb7182bbd521be727492a698b..c348545b13942ec102260f7928307a8a28fc7be2 100644 (file)
@@ -1,4 +1,4 @@
-
+{if $acl}
 <!-- Javacript function used to switch a complete row or col of selected hours -->
 <script language="javascript" type="text/javascript">
   {literal}
@@ -17,6 +17,7 @@
   }
   {/literal}
 </script>
+{/if}
 
 <h1>{t}Specify the hours this user is allowed to log in{/t}</h1>
 <br>
@@ -39,6 +40,7 @@
     {/foreach}
   </tr>
 
+{if $acl}
   <!-- Add toggle buttons for hours -->
   <tr>
     <td style='text-align: left;' class='list0'>
     </td>
     {/foreach}
     <td>
-
       <input type='button' onClick="toggle_chk('^day_[0-9]*_[0-9]*$');" value='+/-' style='width:100%;'>
     </td>
   </tr>
+{/if}
 
   <!-- Add Entries -->
 {foreach from=$Matrix item=days key=key_day}
       {else}
         <td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px;">
       {/if}
-        {if $Matrix[$key_day].$key_hour}
-          <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' checked >
-        {else}
-          <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' >
-        {/if}
+          <input type='checkbox' 
+            {if $acl} id='day_{$key_day}_{$key_hour}' name='day_{$key_day}_{$key_hour}' {/if}
+            {if $Matrix[$key_day].$key_hour} checked  {/if}
+            {if !$acl} disabled {/if}>
       </td>
     {/foreach}
 
+{if $acl}
     <!-- Add toggle button for days -->
     <td>  
       <input type='button' onClick="toggle_chk('^day_{$key_day}_[0-9]*$')" value='+/-'  style='padding:0px;margin:0px;'>
     </td>
+{/if}
   </tr>
 {/foreach}
 </table>
 <input type='hidden' name='sambaLogonHoursPosted' value='1'> 
 <br>
 <p class="plugbottom">
+{if $acl}
   <input type=submit name="save_logonHours" value="{msgPool type=saveButton}">
   &nbsp;
+{/if}
   <input type=submit name="cancel_logonHours" value="{msgPool type=cancelButton}">
 </p>