Code

Made posix trustmodel available in multi edit
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 13 Dec 2007 08:11:21 +0000 (08:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 13 Dec 2007 08:11:21 +0000 (08:11 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8117 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/posix/class_posixAccount.inc
gosa-core/plugins/personal/posix/generic.tpl

index efcef229846210e5b0e85783c110a6c9efea0a1e..5fad0db19c56ea3baa40c6a638992a8dfd763704 100644 (file)
@@ -541,12 +541,11 @@ class posixAccount extends plugin
       }
       $smarty->assign("force_ids", "");
     }
-
     
 
     $smarty->assign("force_idsACL", $this->getacl("uidNumber",$SkipWrite).$this->getacl("gidNumber",$SkipWrite));
 
-    foreach(array("primaryGroup") as $val){
+    foreach(array("primaryGroup","trustmode") as $val){
       if(in_array($val,$this->multi_boxes)){
         $smarty->assign("use_".$val,TRUE);
       }else{
@@ -1424,6 +1423,10 @@ class posixAccount extends plugin
     if(in_array("primaryGroup",$this->multi_boxes)){
       $ret['primaryGroup'] = $this->primaryGroup;
     }
+    if(in_array("trustmode",$this->multi_boxes)){
+      $ret['trustModel'] = $this->trustModel;
+      $ret['accessTo'] = $this->accessTo;
+    }
     return($ret);
   }
 
@@ -1432,12 +1435,30 @@ class posixAccount extends plugin
   {
     if(isset($_POST['posix_mulitple_edit'])){
       plugin::multiple_save_object();
-      foreach(array("primaryGroup") as $val){
+      foreach(array("primaryGroup","trustmode") as $val){
         if(isset($_POST["use_".$val])){
           $this->multi_boxes[] = $val;
         }
       }
 
+      /* Trust mode - special handling */
+      if($this->acl_is_writeable("trustModel")){
+        if (isset($_POST['trustmode'])){
+          $saved= $this->trustModel;
+          if ($_POST['trustmode'] == "1"){
+            $this->trustModel= "fullaccess";
+          } elseif ($_POST['trustmode'] == "2"){
+            $this->trustModel= "byhost";
+          } else {
+            $this->trustModel= "";
+          }
+          if ($this->trustModel != $saved){
+            $this->is_modified= TRUE;
+          }
+        }
+      }
+
+
       /* Save primary group settings */
       if($this->acl_is_writeable("primaryGroup") && isset($_POST['primaryGroup'])){
         $data= $_POST['primaryGroup'];
@@ -1495,8 +1516,25 @@ class posixAccount extends plugin
       }
     }
     $this->groupMembership_some = $groups_some;
-
     $this->primaryGroup = $this->gidNumber;
+
+    /* Is this account a trustAccount? */
+    if (isset($this->multi_attrs['trustModel'])){
+      $this->trustModel= $this->multi_attrs['trustModel'][0];
+      $this->was_trust_account= TRUE;
+      $this->multi_boxes[] = "trustmode";
+    } else {
+      $this->was_trust_account= FALSE;
+      $this->trustModel= "";
+    }
+
+    $this->accessTo = array();
+    if (isset($this->multi_attrs['accessTo'])){
+      for ($i= 0; $i<$this->multi_attrs['accessTo']['count']; $i++){
+        $tmp= $this->multi_attrs['accessTo'][$i];
+        $this->accessTo[$tmp]= $tmp;
+      }
+    }
   }
 
 
index 5371c53b73c3a57fe5364d7d27f16fd079cfad79..1a13058947fd77c73d83c5ff764175f4902ab8cc 100644 (file)
@@ -22,7 +22,7 @@
      </td>
     </tr>
     <tr>
-     <td><label for="">{t}Primary group{/t}</label></td>
+     <td><label for="primaryGroup">{t}Primary group{/t}</label></td>
      <td>
 {render acl=$gidNumberACL checkbox=$multiple_support checked=$use_primaryGroup}
       <select id="primaryGroup" size="1" name="primaryGroup">
   </td>
   <td style="vertical-align:top;">
    <h2><img alt="" class="center" align="middle" src="images/closedlock.png" /> {t}System trust{/t}</h2>
-    {t}Trust mode{/t}&nbsp;
-{render acl=$trustmodeACL}
-       <select name="trustmode" id="trustmode" size=1 onchange="changeSelectState('trustmode', 'wslist'); changeSelectState('trustmode', 'add_ws'); changeSelectState('trustmode', 'del_ws');">
-      {html_options options=$trustmodes selected=$trustmode}
-    </select>
-{/render}
-{render acl=$trustmodeACL}
-   <select style="width:100%" id="wslist" name="workstation_list[]" size=8 multiple {$trusthide}>
-    {html_options values=$workstations output=$workstations}
-       {if $emptyArrAccess}
-               <option disabled>&nbsp;</option>
-       {/if}
-   </select>
-{/render}
-   <br>
-{render acl=$trustmodeACL}
-   <input type="submit" id="add_ws" value="{t}Add{/t}" name="add_ws" {$trusthide}>&nbsp;
-{/render}
-{render acl=$trustmodeACL}
-   <input type="submit" id="del_ws" value="{t}Delete{/t}" name="delete_ws" {$trusthide}>
-{/render}
+{if !$multiple_support}
+       {t}Trust mode{/t}&nbsp;
+       {render acl=$trustmodeACL}
+               <select name="trustmode" id="trustmode" size=1 
+                       onChange="changeSelectState('trustmode', 'wslist'); 
+                                         changeSelectState('trustmode', 'add_ws'); 
+                                     changeSelectState('trustmode', 'del_ws');">
+                 {html_options options=$trustmodes selected=$trustmode}
+               </select>
+       {/render}
+       {render acl=$trustmodeACL}
+          <select style="width:100%" id="wslist" name="workstation_list[]" size=8 multiple {$trusthide}>
+               {html_options values=$workstations output=$workstations}
+               {if $emptyArrAccess}
+                       <option disabled>&nbsp;</option>
+               {/if}
+          </select>
+       {/render}
+          <br>
+       {render acl=$trustmodeACL}
+          <input type="submit" id="add_ws" value="{t}Add{/t}" name="add_ws" {$trusthide}>&nbsp;
+       {/render}
+       {render acl=$trustmodeACL}
+          <input type="submit" id="del_ws" value="{t}Delete{/t}" name="delete_ws" {$trusthide}>
+       {/render}
+
+{else}
+    <input type="checkbox" name="use_trustmode" {if $use_trustmode} checked {/if}
+       class="center" onClick="toggle('div_trustmode');">
+       {t}Trust mode{/t}&nbsp;
+    <div {if !$use_trustmode} style="visibility:hidden;" {/if} id="div_trustmode">
+       {render acl=$trustmodeACL}
+               <select name="trustmode" id="trustmode" size=1 
+                       onChange="changeSelectState('trustmode', 'wslist'); 
+                                         changeSelectState('trustmode', 'add_ws'); 
+                                     changeSelectState('trustmode', 'del_ws');">
+                 {html_options options=$trustmodes selected=$trustmode}
+               </select>
+       {/render}
+       {render acl=$trustmodeACL}
+          <select style="width:100%" id="wslist" name="workstation_list[]" size=8 multiple {$trusthide}>
+               {html_options values=$workstations output=$workstations}
+               {if $emptyArrAccess}
+                       <option disabled>&nbsp;</option>
+               {/if}
+          </select>
+       {/render}
+          <br>
+       {render acl=$trustmodeACL}
+          <input type="submit" id="add_ws" value="{t}Add{/t}" name="add_ws" {$trusthide}>&nbsp;
+       {/render}
+       {render acl=$trustmodeACL}
+          <input type="submit" id="del_ws" value="{t}Delete{/t}" name="delete_ws" {$trusthide}>
+       {/render}
+       </div>
+{/if}
   </td>
  </tr>
 </table>