Code

Initial acl fixes for workstation Startup
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 1 Sep 2006 04:25:30 +0000 (04:25 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 1 Sep 2006 04:25:30 +0000 (04:25 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4562 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_workstationStartup.inc
plugins/admin/systems/workstationStartup.tpl

index ba39d60db3235177802da29de35d4e9eb1ccc637..65dbad2193fefe76fdea2d6b84cfd3c0714b9352 100644 (file)
@@ -469,14 +469,14 @@ class workstartup extends plugin
 
     /* Add module */
     if (isset ($_POST['add_module'])){
-      if ($_POST['module'] != "" && chkacl ($this->acl, "gotoModule") == ""){
+      if ($_POST['module'] != "" && $this->acl_is_writeable("gotoModule")){
         $this->add_list ($this->gotoModules, $_POST['module']);
       }
     }
 
     /* Delete module */
     if (isset ($_POST['delete_module'])){
-      if (count($_POST['modules_list']) && chkacl ($this->acl, "gotoModule") == ""){
+      if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoModule")){
         $this->del_list ($this->gotoModules, $_POST['modules_list']);
       }
     }
@@ -580,6 +580,13 @@ class workstartup extends plugin
 
     /* Show main page */
     $smarty= get_smarty();
+
+    /* Assign ACLs to smarty */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    } 
+
     $smarty->assign("SelectBoxLdapServer","");
 
     /* In this section server shares will be defined
@@ -658,7 +665,6 @@ class workstartup extends plugin
 
     $smarty->assign("SelectBoxLdapServer",$SelectBoxLdapServer->DrawList());
 
-    $smarty->assign("gotoLdapServerACL", chkacl($this->acl, "gotoLdapServer"));
     foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
       $smarty->assign("$val", $this->$val);
     }
@@ -666,7 +672,6 @@ class workstartup extends plugin
     /* Values */
     foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){
       $smarty->assign($val, $this->$val);
-      $smarty->assign($val."ACL", chkacl($this->acl, $val));
     }
 
     $smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors());
@@ -675,8 +680,13 @@ class workstartup extends plugin
     $smarty->assign("FAIclasses",$this->selectFriendlyClasses());
     $smarty->assign("FAIclassesKeys",array_flip($this->selectFriendlyClasses()));
     $smarty->assign("FAIclassKeys",$this->FAIclass);
-    $smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease);
-    
+  
+    $inheritedRelease = array();
+    if(!empty($this->InheritedFAIrelease)){
+      $inheritedRelease[$this->InheritedFAIrelease]= $this->InheritedFAIrelease;
+    } 
+    $smarty->assign("InheritedFAIrelease",$inheritedRelease);
     $div = new divSelectBox("WSFAIscriptClasses");
     $div -> SetHeight("110");
     $str_up     = " &nbsp;<input type='image' src='images/sort_up.png'    name='sort_up_%s'    value='%s'>";
@@ -732,11 +742,6 @@ class workstartup extends plugin
       $smarty->assign("debugbootup", "");
     }
 
-    /* ACL's */
-    foreach (array("gotoKernelParameters", "gotoModules", "gotoFilesystem","FAIclass") as $value){
-      $smarty->assign($value."ACL", chkacl($this->acl, "$value"));
-    }
-
     /* Show main page */
     return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__))));
   }
@@ -864,12 +869,12 @@ class workstartup extends plugin
     plugin::save_object();
 
     /* Save group radio buttons */
-    if (chkacl ($this->acl, "bootmode") == "" && isset($_POST["bootmode"])){
+    if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){
       $this->bootmode= $_POST["bootmode"];
     }
 
     /* Save kernel parameters */
-    if (chkacl ($this->acl, "gotoKernelParameters") == "" && isset($_POST["customParameters"])){
+    if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){
       $this->customParameters= $_POST["customParameters"];
     }
 
@@ -1094,11 +1099,15 @@ class workstartup extends plugin
             "gotoLdapServer"        => _("Ldap server"),
             "gotoBootKernel"        => _("Boot kernel"),
             "gotoKernelParameters"  => _("Kernel parameter"),
-            "FAIclass"              => _("FAI classes"),
-            "FAIstatus"             => _("FAI status flag"),
+
+            "gotoModules"           => _("Kernel modules"),
             "gotoShare"             => _("Shares"),
+
+            "FAIclass"              => _("FAI classes"),
             "FAIdebianMirror"       => _("Debian mirror"),
-            "FAIrelease"            => _("Debian release"))
+            "FAIrelease"            => _("Debian release"),
+
+            "FAIstatus"             => _("FAI status flag")) // #FIXME is this acl realy necessary ?
           ));
   }
 }
index 117bb7a835d4d88a0a7a0bff5f093434f72efb64..7f7b9e807b218a2ab2b5d6e304bfec833bb5c4c8 100644 (file)
@@ -7,20 +7,28 @@
     <tr>
      <td><LABEL for="gotoBootKernel">{t}Boot kernel{/t}</LABEL></td>
      <td style="width:70%">
-        <select id="gotoBootKernel" name="gotoBootKernel" {$gotoBootKernelACL}>
+{render acl=$gotoBootKernelACL}
+        <select id="gotoBootKernel" name="gotoBootKernel">
          {html_options options=$gotoBootKernels selected=$gotoBootKernel}
          <option disabled>&nbsp;</option>
        </select>
+{/render}
       </td>
     </tr>
     <tr>
      <td><LABEL for="customParameters">{t}Custom options{/t}</LABEL></td>
-     <td><input name="customParameters" id="customParameters" size=25 maxlength=500 {$gotoKernelParametersACL}
-                value="{$customParameters}" title="{t}Enter any parameters that should be passed to the kernel as append line during bootup{/t}"></td>
+     <td>
+{render acl=$gotoKernelParametersACL}
+       <input name="customParameters" id="customParameters" size=25 maxlength=500
+                value="{$customParameters}" title="{t}Enter any parameters that should be passed to the kernel as append line during bootup{/t}">
+{/render}
+     </td>
     </tr>
     <tr>
      <td colspan="2" style='vertical-align:top;padding-top:3px;'><LABEL for="gotoLdapServer">{t}LDAP server{/t}</LABEL><br>
+{render acl=$gotoLdapServerACL}
          {$SelectBoxLdapServer}        
+{/render}
      </td>
     </tr>
    </table>
                        </tr>
                        <tr>
                                <td>
+{render acl=$FAIdebianMirrorACL}
                                        <select name="FAIdebianMirror"   onchange='document.mainform.submit()'>
                                                {html_options options=$FAIdebianMirrors output=$FAIdebianMirrors selected=$FAIdebianMirror}
                                        </select>
+{/render}
                                </td>
                                <td>
                                        <select name="FAIrelease"  disabled>
@@ -62,7 +72,9 @@
                <h2>
                        <img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Assigned FAI classes{/t}
                </h2>
+{render acl=$FAIclassACL}
                {$FAIScriptlist}        
+{/render}
        {else}
 
                <table>
                        </tr>
                        <tr>
                                <td>
-                                       <select name="FAIdebianMirror" {$FAIdebianMirrorACL} onchange='document.mainform.submit()'>
+{render acl=$FAIdebianMirrorACL}
+                                       <select name="FAIdebianMirror" onchange='document.mainform.submit()'>
                                                {html_options options=$FAIdebianMirrors output=$FAIdebianMirrors selected=$FAIdebianMirror}
-                                               <option disabled>&nbsp;</option>
                                        </select>
-                                       {if $javascript eq 'false'}<input type="submit" value="{t}set{/t}" name="refresh">{/if}
+{/render}
+{if $javascript eq 'false'}
+{render acl=$FAIdebianMirrorACL}
+       <input type="submit" value="{t}set{/t}" name="refresh">
+{/render}
+{/if}
                                </td>
                                <td>
+{render acl=$FAIreleaseACL}
                                        <select name="FAIrelease"  onchange='document.mainform.submit()'>
                                        {html_options options=$FAIreleases output=$FAIreleases selected=$FAIrelease}
                                        </select>
+{/render}
                                </td>
                        </tr>
                </table>
                <h2>
                        <img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Assigned FAI classes{/t}
                </h2>
+{render acl=$FAIclassACL}
                {$FAIScriptlist}        
+{/render}
 
-               <select name="FAIclassesSel" {$FAIclassACL}>
+               <select name="FAIclassesSel">
                        {html_options values=$FAIclassesKeys output=$FAIclasses}
                        <option disabled>&nbsp;</option>
                </select>       
    <h2>
     <img class="center" alt="" align="middle" src="images/hardware.png"> {t}Kernel modules (format: name parameters){/t}
    </h2>
+{render acl=$gotoModulesACL}
     <select style="width:100%; height:150px;" name="modules_list[]" size=15 multiple title="{t}Add additional modules to load on startup{/t}">
      {html_options values=$gotoModules output=$gotoModules}
         <option disabled>&nbsp;</option>
     </select>
+{/render}
     <br>
-    <input name="module" size=30 align=middle maxlength=30 {$gotoModulesACL}>
-    <input type=submit value="{t}Add{/t}" name="add_module" {$gotoModulesACL}>&nbsp;
-    <input type=submit value="{t}Delete{/t}" name="delete_module" {$gotoModulesACL}>
+{render acl=$gotoModulesACL}
+    <input name="module" size=30 align=middle maxlength=30>
+{/render}
+{render acl=$gotoModulesACL}
+    <input type=submit value="{t}Add{/t}" name="add_module">&nbsp;
+{/render}
+{render acl=$gotoModulesACL}
+    <input type=submit value="{t}Delete{/t}" name="delete_module">
+{/render}
   </td>
 
   <td style="vertical-align:top;">
         <table summary="" style="width:100%">
                 <tr>
                         <td>
-                        <select style="width:100%;height:150px;" name="gotoShare" multiple size=4 {$gotoShareACL} id="gotoShare">
+{render acl=$gotoShareACL}
+                        <select style="width:100%;height:150px;" name="gotoShare" multiple size=4 id="gotoShare">
                                             {html_options values=$gotoShareKeys output=$gotoShares}
                                                                <option disabled>&nbsp;</option>
                                 </select>
+{/render}
                                 <br>
-                        <select name="gotoShareSelection" {$gotoShareACL}>
+{render acl=$gotoShareACL}
+                        <select name="gotoShareSelection">
                                                    {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
                                                        <option disabled>&nbsp;</option>
                                 </select>
-                                <input type="text" size=15 {$gotoShareACL} name="gotoShareMountPoint" value="{t}Mountpoint{/t}">
-                                <input type="submit" {$gotoShareACL} name="gotoShareAdd" value="{t}Add{/t}">
-                                <input type="submit" {$gotoShareACL} name="gotoShareDel" value="{t}Remove{/t}" {if $gotoSharesCount == 0} disabled {/if}>
+{/render}
+{render acl=$gotoShareACL}
+                                <input type="text" size=15 name="gotoShareMountPoint" value="{t}Mountpoint{/t}">
+{/render}
+{render acl=$gotoShareACL}
+                                <input type="submit" name="gotoShareAdd" value="{t}Add{/t}">
+{/render}
+{render acl=$gotoShareACL}
+                                <input type="submit" name="gotoShareDel" value="{t}Remove{/t}" {if $gotoSharesCount == 0} disabled {/if}>
+{/render}
                         </td>
                 </tr>
         </table>
   <!-- // First input field on page
   document.mainform.gotoLdapServer.focus();
   -->
+</script>