From 980f5f8a6d5690f103f74ab51f8a193a61584ff9 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 19 May 2011 07:00:22 +0000 Subject: [PATCH] Updated Config Item mangement, we are now able to set Acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20870 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../newConfigManagement/DeviceConfig-list.xml | 2 +- .../class_ConfigManagement.inc | 9 ++++++--- .../class_ConfigManagementDataModel.inc | 20 ++++++++++++++++++- .../class_filterConfigManagement.inc | 4 ++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.xml b/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.xml index 883cfb1dc..d3a1b6ec2 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.xml +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.xml @@ -79,7 +79,7 @@ remove entry images/lists/trash.png - ConfigManagement/cfgItem[w] + ConfigManagement/ConfigManagement[createFAICD:w] diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc index a54591923..b474d4ece 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc @@ -520,7 +520,7 @@ class ConfigManagement extends plugin function openEntry($ids) { $id = $ids[0]; - $item = $this->dataModel->getItemById($id); + $item = $this->dataModel->getItemByDn($id); $this->setCurrentContainer($item['path']); return; } @@ -532,7 +532,7 @@ class ConfigManagement extends plugin function removeEntry($ids) { foreach($ids as $id){ - $item = $this->dataModel->getItemById($id); + $item = $this->dataModel->getItemByDn($id); // Is an config item. if($this->cfgItemMap[$item['type']] != 'root'){ @@ -612,7 +612,10 @@ class ConfigManagement extends plugin */ function editEntry($ids) { - $item = $this->dataModel->getItemById($ids[0]); + $item = $this->dataModel->getItemByDn($ids[0]); + + if(!$item) return; + $release = $this->getReleasePart($item['path']); $path = $this->getItemPath($item['path']); $method = $this->cfgItemMap[$item['type']]; diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc index d50b3f71b..d73e35f06 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc @@ -5,6 +5,7 @@ class ConfigManagementDataModel public $data = array(); public $typeToPath = array(); public $idToPath = array(); + public $dnToPath = array(); function __construct() { @@ -30,12 +31,13 @@ class ConfigManagementDataModel $toParentPath = preg_replace("/\/[^\/]*$/","", $to); $parentTo = &$this->data['linear'][$toParentPath]; $parentToDn = $parentTo['dn']; + $dn = rtrim("cn={$name},{$parentToDn}",','); // Append the 'from' entry to the 'to' parent children. $parentTo['children'][$to] = $parentFrom['children'][$from]; $parentTo['children'][$to]['path']= $to; $parentTo['children'][$to]['name']= $name; - $parentTo['children'][$to]['dn']= rtrim("cn={$name},{$parentToDn}",','); + $parentTo['children'][$to]['dn']= $dn; // Unset the source path unset($parentFrom['children'][$from]); @@ -47,6 +49,7 @@ class ConfigManagementDataModel // Update id->Path mapping $id = $this->data['linear'][$to]['id']; $this->idToPath[$id] = $to; + $this->dnToPath[$dn] = $to; } @@ -94,6 +97,7 @@ class ConfigManagementDataModel $this->data['linear'][$entryPath] = &$parentItem[$entryPath]; $this->idToPath[$entryId] = $entryPath; + $this->idToPath[$entryDn] = $entryPath; $this->typeToPath[$type][$name] = $entryPath; return($entryId); @@ -168,6 +172,20 @@ class ConfigManagementDataModel } return(NULL); } + + function getItemByDn($dn) + { + $path = NULL; + if(isset($this->dnToPath[$dn])){ + $path = $this->dnToPath[$dn]; + }else{ + return(NULL); + } + if(isset($this->data['linear'][$path])){ + return($this->data['linear'][$path]); + } + return(NULL); + } } ?> diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_filterConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_filterConfigManagement.inc index db43ea525..fce191f93 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_filterConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_filterConfigManagement.inc @@ -18,7 +18,7 @@ class filterConfigManagement { $ret = array(); if($data['path'] != "/root"){ $back = array(); - $back['dn'] = $data['id']; + $back['dn'] = $data['dn']; $back[] = 'dn'; $back['cn'] = array('.', 'count' => 1); $back[] = 'cn'; @@ -40,7 +40,7 @@ class filterConfigManagement { { if(preg_match("/".$filter."/",$item['name'])){ $entry = array(); - $entry['dn'] = $item['id']; + $entry['dn'] = $item['dn']; $entry[] = 'dn'; $entry['cn'] = array($item['name'], 'count' => 1); $entry[] = 'cn'; -- 2.30.2