Code

Updated ACLs for devices
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 19 May 2011 12:31:35 +0000 (12:31 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 19 May 2011 12:31:35 +0000 (12:31 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20887 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl
gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc
gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc

index 096d14cbe4a8890c59eb8343438d17e327ce49a7..0750f4d8cecc9293aa784ceb586d9c66cbb4de68 100644 (file)
@@ -7,28 +7,34 @@
                 <tr>
                     <td><LABEL for="installTemplate">{t}Template{/t}</LABEL></td>
                     <td>
+                        {render acl=$installTemplateACL}
                         <select name="installTemplate" size=1 onChange="document.mainform.submit();">
                             {html_options options=$installTemplateList 
                             selected=$installTemplate}
                         </select>
+                        {/render}
                     </td>
                 </tr>
                 <tr>
                     <td><LABEL for="installRelease">{t}Release{/t}</LABEL></td>
                     <td>
+                        {render acl=$installReleaseACL}
                         <select name="installRelease" size=1 onChange="document.mainform.submit();">
                             {html_options options=$installReleaseList 
                             selected=$installRelease}
                         </select>
+                        {/render}
                     </td>
                 </tr>
                 <tr>
                     <td><LABEL for="installConfigManagement">{t}Config management{/t}</LABEL></td>
                     <td>
+                        {render acl=$installConfigManagementACL}
                         <select name="installConfigManagement" size=1 onChange='document.mainform.submit();'>
                             {html_options options=$installConfigManagementList 
                             selected=$installConfigManagement}
                         </select>
+                        {/render}
                     </td>
                 </tr>
             </table>
                 <tr>
                     <td><LABEL for="installPartitionTable">{t}Partition table{/t}</LABEL></td>
                     <td>
+                        {render acl=$installPartitionTableACL}
                         <input type='submit' name="edit_installPartitionTable" id="edit_installPartitionTable" 
                             value="{t}Edit partition table{/t}">
+                        {/render}
                     </td>
                 </tr>
             </table>
                 <tr>
                     <td><LABEL for="installMirror">{t}Mirror{/t}</LABEL></td>
                     <td>
+                        {render acl=$installMirrorACL}
                         <select name="installMirror" size=1>
                             {html_options options=$installMirrorList 
                             selected=$installMirror}
                         </select>
+                        {/render}
                     </td>
                 </tr>
                 <tr>
                     <td><LABEL for="installKernelPackage">{t}Kernel package{/t}</LABEL></td>
                     <td>
+                        {render acl=$installKernelPackageACL}
                         <select name="installKernelPackage" size=1>
                             {html_options values=$installKernelPackageList output=$installKernelPackageList 
                             selected=$installKernelPackage}
                         </select>
+                        {/render}
                     </td>
                 </tr>
             </table>
             <table>
                 <tr>
                     <td>
+                        {render acl=$installRootEnabledACL}
                         <input type='checkbox' value='1' {if $installRootEnabled} checked {/if}
                             onClick="changeState('setPasswordHash');"
                             name="installRootEnabled" id="installRootEnabled" 
                            >
+                        {/render}
                         <LABEL for="installRootEnabled">{t}Use root user{/t}</LABEL>&nbsp;
+                        {render acl=$installRootPasswordHashACL}
                         <button name='setPasswordHash'
                             {if !$installRootEnabled} disabled {/if}
                             id="setPasswordHash">{t}Set password{/t}</button>
+                        {/render}
                     </td>
                 </tr>
             </table>
                 <tr>
                     <td><LABEL for="installKeyboardlayout">{t}Keyboard layout{/t}</LABEL></td>
                     <td>
+                        {render acl=$installKeyboardlayoutACL}
                         <select name="installKeyboardlayout" size=1>
                             {html_options options=$installKeyboardlayoutList
                             selected=$installKeyboardlayout}
                         </select>
+                        {/render}
                     </td>
                 </tr>
                 <tr>
                     <td><LABEL for="installSystemLocale">{t}System locale{/t}</LABEL></td>
                     <td>
+                        {render acl=$installSystemLocaleACL}
                         <select name="installSystemLocale" size=1>
                             {html_options options=$installSystemLocaleList 
                             selected=$installSystemLocale}
                         </select>
+                        {/render}
                     </td>
                 </tr>
             </table>
             <table>
                 <tr>
                     <td>
+                        {render acl=$installTimeUTCACL}
                         <input type='checkbox' name="installTimeUTC" id="installTimeUTC" 
                         {if $installTimeUTC} checked {/if}>
                         <LABEL for="installTimeUTC">{t}Use UTC{/t}</LABEL>
+                        {/render}
                     </td>
                 </tr>
                 <tr>
                     <td><LABEL for="installTimezone">{t}Timezone{/t}</LABEL></td>
                     <td>
+                        {render acl=$installTimezoneACL}
                         <select size='1' name="installTimezone" id="installTimezone">
                             {html_options output=$timezones values=$timezones 
                             selected=$installTimezone}
                         </select>
+                        {/render}
                     </td>
                 </tr>
                 <tr>    
                     <td colspan=2>
                         {t}NTP server{/t}
-                        {$installNTPServerList}
-                        <input type='text' name="installNTPServer_Input">
-                        <button name='installNTPServer_Add'>{msgPool type=addButton}</button>
+                        {render acl=$installNTPServerACL}
+                            {$installNTPServerList}
+                        {/render}
+                        {render acl=$installNTPServerACL}
+                            <input type='text' name="installNTPServer_Input">
+                        {/render}
+                        {render acl=$installNTPServerACL}
+                            <button name='installNTPServer_Add'>{msgPool type=addButton}</button>
+                        {/render}
                     </td>
                 </tr>
             </table>
index a9a706c2cc0133bacf5ee7b7f9b6ccf1b13cc6e9..242d8a487fb0cae37a15a9a987a93ec143003612 100644 (file)
@@ -41,7 +41,7 @@ class DeviceConfig extends plugin
         $this->assignableElementsList->setHeight("200px");
         $this->assignableElementsList->setHeader(array(_("Name"),_("Description"),_("Add")));
         $this->assignableElementsList->setColspecs(array('*','*','20'));
-        $this->assignableElementsList->setAcl('rwcdm');
+        $this->assignableElementsList->setAcl($this->getacl(''));
 
         // Create used Elements list.
         $this->usedElementsList = new sortableListing();
@@ -52,7 +52,7 @@ class DeviceConfig extends plugin
         $this->usedElementsList->setHeight("200px");
         $this->usedElementsList->setHeader(array(_("Name"), _("Description"), _("Remove")));
         $this->usedElementsList->setColspecs(array('*','*','20'));
-        $this->usedElementsList->setAcl('rwcdm');
+        $this->usedElementsList->setAcl($this->getacl(''));
 
         // Create parameter Elements list.
         $this->parameterList = new sortableListing();
@@ -63,7 +63,7 @@ class DeviceConfig extends plugin
         $this->parameterList->setHeight("200px");
         $this->parameterList->setHeader(array(_("Name"), _("Description"), _("Value")));
         $this->parameterList->setColspecs(array('*','*','350px'));
-        $this->parameterList->setAcl('rwcdm');
+        $this->parameterList->setAcl($this->getacl(''));
     }
 
 
@@ -76,7 +76,6 @@ class DeviceConfig extends plugin
      */ 
     function execute()
     {
-
         // Initialize to plugin
         if(!$this->initialized){
 
@@ -200,6 +199,9 @@ class DeviceConfig extends plugin
                 if(!isset($this->parameterWidgets[$param])){
                     $this->parameterWidgets[$param] = new TemplateWidget_stringLong($this->config, $param, $value, 
                             $desc, '', FALSE, 'string', $param);
+
+                    $this->parameterWidgets[$param]->setWriteable(preg_match("/w/",$this->getacl('')));
+                    $this->parameterWidgets[$param]->setReadable(preg_match("/r/",$this->getacl('')));
                 }
                 $w = $this->parameterWidgets[$param];
                 $lData[$param] = array('data' => array($w->getDisplayName(),$desc, $w->render()));
@@ -225,24 +227,29 @@ class DeviceConfig extends plugin
     {
         // Get posted parameter values
         foreach($this->parameterWidgets as $name => $w){
-            $w->save_object();
-            $this->parameterValues[$name] = $w->getValue();
+            if($w->isWriteable()){
+                $w->save_object();
+                $this->parameterValues[$name] = $w->getValue();
+            }
         }
 
-        // Act on Add-Element actions
-        $this->assignableElementsList->save_object();
-        $action = $this->assignableElementsList->getAction();
-        if($action['action'] == 'edit'){
-            $this->usedElements[] = $this->assignableElementsList->getKey($action['targets'][0]);
-            $this->usedElements = array_unique($this->usedElements);
-        }
+        if(preg_match("/w/", $this->getacl(''))){
 
-        // Act on Remove-Item actions
-        $this->usedElementsList->save_object();
-        $action = $this->usedElementsList->getAction();
-        if($action['action'] == 'delete'){
-            $name = $this->usedElementsList->getKey($action['targets'][0]);
-            $this->usedElements = array_remove_entries_ics(array($name), $this->usedElements);
+            // Act on Add-Element actions
+            $this->assignableElementsList->save_object();
+            $action = $this->assignableElementsList->getAction();
+            if($action['action'] == 'edit'){
+                $this->usedElements[] = $this->assignableElementsList->getKey($action['targets'][0]);
+                $this->usedElements = array_unique($this->usedElements);
+            }
+
+            // Act on Remove-Item actions
+            $this->usedElementsList->save_object();
+            $action = $this->usedElementsList->getAction();
+            if($action['action'] == 'delete'){
+                $name = $this->usedElementsList->getKey($action['targets'][0]);
+                $this->usedElements = array_remove_entries_ics(array($name), $this->usedElements);
+            }
         }
     }
 
index d7694e6f68a50370b3e77263425a5fb4891f140b..211e33ccda4149ce7bf56b9b4a5e03fd864cd352 100644 (file)
@@ -370,10 +370,14 @@ class InstallRecipe extends plugin
 
         plugin::execute();    
         $smarty = get_smarty();
-        $smarty->assign('installTemplateList', $this->installationTemplateNames);
-        $smarty->assign('installReleaseList', $this->templateToRelease[$this->installTemplate]);
 
+        // Assign ACLs
+        foreach($this->attributes as $attr){
+            $smarty->assign("{$attr}ACL", $this->getacl($attr));
+        }
 
+        $smarty->assign('installTemplateList', $this->installationTemplateNames);
+        $smarty->assign('installReleaseList', $this->templateToRelease[$this->installTemplate]);
         $smarty->assign('timezones', $this->timezones);
         $smarty->assign('installKeyboardlayoutList', $this->installKeyboardlayoutList);
         $smarty->assign('installKernelPackageList', $this->installKernelPackageList);
@@ -693,21 +697,20 @@ class InstallRecipe extends plugin
                     "plSection"     => array("administration"),
                     "plCategory"    => array("Device"),
                     "plProvidedAcls" => array(
-                        "member" => _("Member"),
-                        "installTemplate" => _("Installation template"),
-                        "installRelease" => _("Installation release"),
 
-                        "installBootstrapMethod" => _("Bootstrap method"),
-                        "installConfigManagement" => _("Config management"),
+                        "installRelease" => _("Release"),
+                        "installTemplate" => _("Template"),
                         "installKeyboardlayout" => _("Keyboard layout"),
-                        "installSystemLocale" => _("System locale"),
+                        "installSystemLocale" => _("Locale"),
                         "installTimezone" => _("Timezone"),
-                        "installTimeUTC" => _("Time"),
-                        "installNTPServer" => _("NTP-Server"),
+                        "installTimeUTC" => _("Utc"),
+                        "installNTPServer" => _("Ntp server"),
                         "installMirror" => _("Mirror"),
                         "installRootEnabled" => _("Root login enabled"),
                         "installRootPasswordHash" => _("Root password hash"),
                         "installKernelPackage" => _("Kernel package"),
+                        "installConfigManagement" => _("Config mangement"),
+                        "installBootstrapMethod" => _("Bootstrap method"),
                         "installPartitionTable" => _("Partition table")
                         )
                         )