summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 397e808)
raw | patch | inline | side by side (parent: 397e808)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 May 2011 09:05:12 +0000 (09:05 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 May 2011 09:05:12 +0000 (09:05 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20879 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateEngine.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateEngine.inc
index e41f61f1f21176d31370d5f5561a2d9b70b8119d..978fc5f611bc7a467f4b0c904ccd91d3c5f35dbb 100644 (file)
}
- function editItem($type, $values)
+ function editItem($type, $values, $acls = array())
{
$this->is_new = FALSE;
+ $this->setAcls($acls);
$this->setValues($type, $values);
}
- function createItem($type, $values)
+ function createItem($type, $values, $acls = array())
{
$this->is_new = TRUE;
+ $this->setAcls($acls);
$this->setValues($type, $values);
}
+
+
+ function setAcls($acls)
+ {
+ $this->acls = $acls;
+ }
/*! \brief Sets the current item type we want to render
$syntax = (isset($item['syntax']))? $item['syntax']: "";
$providedValues = (isset($item['values']))? $item['values']: array();
+ // Get acl definition
+ if(isset($this->acls[$name])) {
+ $acl = $this->acls[$name];
+ }else{
+ print "<br> No ACL definition for '{$name}'.";
+ $acl = "";
+ }
+
// Create the new widget.
$this->widgets[$name] = new $widgetClassName($this->config, $name,
$value,
$item['required'],
$item['type'],
$item['display'],
- $providedValues);
+ $providedValues);
+ // Get Permissions
+ $writeable = preg_match("/w/", $acl);
+ $readable = preg_match("/w/", $acl);
+
// Check if we've to disable this item.
if(isset($item['disable']) && $item['disable'] ||
(isset($item['initiallyEditableOnly']) && $item['initiallyEditableOnly'] && !$this->is_new)){
- $this->widgets[$name]->setEnabled(FALSE);
+ $writeable = FALSE;
}
+
+ // Set ACls
+ $this->widgets[$name]->setWriteable($writeable);
+ $this->widgets[$name]->setReadable($readable);
}
}
}
function save_object()
{
foreach($this->widgets as $widget){
- if($widget->isEnabled()){
+ if($widget->isEnabled() && $widget->isWriteable()){
$widget->save_object();
}
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget.inc
index b5e48a5a6c1b6e99c97e0c54b018496ac1f5e488..76635ded6a60fefcfcc973620688bca96261a06e 100644 (file)
$this->enabled = $bool;
}
+
+ /*! \brief Sets the writeable status for a widget
+ */
+ function setWriteable($bool = TRUE)
+ {
+ $this->writeable = $bool;
+ }
+
+
+ /*! \brief Sets the readable status for a widget
+ */
+ function setReadable($bool = TRUE)
+ {
+ $this->readable = $bool;
+ }
+
/*! \brief Returns the enable status.
*/
}
+ /*! \brief Returns the writeable status.
+ */
+ function isWriteable()
+ {
+ return($this->writeable);
+ }
+
+
+ /*! \brief Returns the readable status.
+ */
+ function isReadable()
+ {
+ return($this->readable);
+ }
+
+
/*! \brief Returns the display-name for the current widget.
* @return String The display-name for the widget, this
* name will usually be rendered infront of input fields.
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_string.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_string.inc
index 99dc273b83f1350b7f4c1f2eb2cf020bcad6eb16..546517aa5262d6fb2f269f67b66acf43e6af5d9e 100644 (file)
{
$desc = set_post($this->description);
$value = set_post($this->value);
-
+
$name = " name=\"{$this->postName}\" ";
$value = " value=\"{$value}\" ";
$title = (empty($this->description))?"": " title=\"{$desc}\"";
- $disabled = (!$this->enabled)? "disabled" : "";
+ $disabled = (!$this->enabled || !$this->writeable)? "disabled" : "";
+ $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $name;
return("<input type='text' {$title} {$name} {$value} {$disabled}>");
}
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc
index 6bb37d2a6619838587a08541fedffd76636fe165..f8db6f33f4260ce64213a31850a916367741937c 100644 (file)
}
}
}
+
+ // Collect property acls. The is only one ACL defined which controls all widgets.
+ $ui = get_userinfo();
+ $acls = array();
+ $acl = $ui->get_permissions($item['dn'], "ConfigManagement/ConfigManagement","cfgItem");
+ foreach(array_keys($this->itemConfig[$item['type']]['options']) as $attr){
+ $acls[$attr] = $acl;
+ }
+ // Update the template engine and set the item-config, values and the acls to use.
$this->TemplateEngine->load($this->itemConfig);
$this->TemplateEngine->setTemplate($method.".tpl");
- $this->TemplateEngine->editItem($item['type'],$item['values']);
+ $this->TemplateEngine->editItem($item['type'],$item['values'], $acls);
+
$this->listing->setDialogObject($this->TemplateEngine);
$this->currentObject = $item;
}
*/
function newEntry($type)
{
+ $item = $this->dataModel->getItemByPath($this->selectedContainer);
+
+ // Collect property acls. The is only one ACL defined which controls all widgets.
+ $ui = get_userinfo();
+ $acls = array();
+ $acl = $ui->get_permissions($item['dn'], "ConfigManagement/ConfigManagement","cfgItem");
+ foreach(array_keys($this->itemConfig[$type]['options']) as $attr){
+ $acls[$attr] = $acl;
+ }
+
// We've to add a config item
$this->TemplateEngine->load($this->itemConfig);
if($this->cfgItemMap[$type] != 'root'){
$method = $this->cfgItemMap[$type];
$this->TemplateEngine->setTemplate($method.".tpl");
- $this->TemplateEngine->createItem($type,array());
+ $this->TemplateEngine->createItem($type, array(), $acls);
$this->listing->setDialogObject($this->TemplateEngine);
$this->currentObject = NULL;
}else{
$this->TemplateEngine->setTemplate("root.tpl");
- $this->TemplateEngine->createItem($type,array());
+ $this->TemplateEngine->createItem($type, array(), $acls);
$this->listing->setDialogObject($this->TemplateEngine);
$this->currentObject = NULL;
}