From f0b1aecca3978717a73015f2c5a5d695c801c1f2 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 19 May 2011 12:31:35 +0000 Subject: [PATCH] Updated ACLs for devices git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20887 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/goto/Device/InstallRecipe.tpl | 36 +++++++++++++-- .../goto/Device/class_DeviceConfig.inc | 45 +++++++++++-------- .../goto/Device/class_InstallRecipe.inc | 23 +++++----- 3 files changed, 72 insertions(+), 32 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl b/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl index 096d14cbe..0750f4d8c 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl @@ -7,28 +7,34 @@ + {render acl=$installTemplateACL} + {/render} + {render acl=$installReleaseACL} + {/render} + {render acl=$installConfigManagementACL} + {/render} @@ -39,8 +45,10 @@ + {render acl=$installPartitionTableACL} + {/render} @@ -58,19 +66,23 @@ + {render acl=$installMirrorACL} + {/render} + {render acl=$installKernelPackageACL} + {/render} @@ -81,14 +93,18 @@
+ {render acl=$installRootEnabledACL} + {/render}   + {render acl=$installRootPasswordHashACL} + {/render}
@@ -105,19 +121,23 @@ + {render acl=$installKeyboardlayoutACL} + {/render} + {render acl=$installSystemLocaleACL} + {/render} @@ -128,26 +148,36 @@
+ {render acl=$installTimeUTCACL} + {/render}
+ {render acl=$installTimezoneACL} + {/render}
{t}NTP server{/t} - {$installNTPServerList} - - + {render acl=$installNTPServerACL} + {$installNTPServerList} + {/render} + {render acl=$installNTPServerACL} + + {/render} + {render acl=$installNTPServerACL} + + {/render}
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc index a9a706c2c..242d8a487 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc @@ -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); + } } } diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc index d7694e6f6..211e33ccd 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc @@ -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") ) ) -- 2.30.2