summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b15bfa2)
raw | patch | inline | side by side (parent: b15bfa2)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 4 Mar 2010 13:53:38 +0000 (13:53 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 4 Mar 2010 13:53:38 +0000 (13:53 +0000) |
Fix inconsistent class display:
- Show scripts that are inheritted from a parent release
- Add a new function FAI::get_leaf_objects that gets a list
of class leaf objects which are part of the given class
in the current release and its parents
- faiScript: Use get_leaf_objects to find leaf objects
- faiTemplate: Use get_leaf_objects to find leaf objects
- faiVariable: Use get_leaf_objects to find leaf objects
- faiPartitionTable: use get_leaf_objects to find leaf objects
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@16071 594d385d-05f5-0310-b6e9-bd551577e9d8
- Show scripts that are inheritted from a parent release
- Add a new function FAI::get_leaf_objects that gets a list
of class leaf objects which are part of the given class
in the current release and its parents
- faiScript: Use get_leaf_objects to find leaf objects
- faiTemplate: Use get_leaf_objects to find leaf objects
- faiVariable: Use get_leaf_objects to find leaf objects
- faiPartitionTable: use get_leaf_objects to find leaf objects
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@16071 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc b/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc
index a1532602236526decbe6c3e7e2cf689103d885ac..1d2ead0c1e8c258ecfc7415f501b4f49c0ea2e69 100644 (file)
return false;
}
+ static function get_leaf_objects($dn, $cn, $subclass, $rdn) {
+ $valid_releases = FAI::get_previous_releases_of_this_release(FAI::get_release_dn($dn), true);
+ /* Remove the last release DN */
+ array_pop($valid_releases);
+ $valid_releases[] = FAI::get_release_dn($dn);
+
+ $objects = FAI::get_all_objects_for_given_base($dn,"(&(objectClass=FAIclass)(objectClass=".$subclass."))");
+ $res = array();
+ /* Strip elements which are not a leaf object of the current dn */
+ foreach($objects as $obj){
+ $keep = FALSE;
+ foreach($valid_releases as $valid_release) {
+ if (preg_match("/cn=".$cn.",".$rdn.$valid_release."$/", $obj['dn'])) {
+ $keep = TRUE;
+ break;
+ }
+ }
+
+ if ($keep) {
+ $res[] = $obj;
+ }
+ }
+
+ return $res;
+ }
+
+
}
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiHook.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiHook.inc
index 3fdd7070f291a1832b6c2627df639c7921ea5fcd..281b3d6becb09cefa6f5e8447730756398bfd883 100644 (file)
*/
if($dn != "new"){
$this->dn =$dn;
-
- /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
- */
- $res = FAI::get_all_objects_for_given_base($this->dn,"(&(objectClass=FAIclass)(objectClass=".$this->subClass."))");
- foreach($res as $obj){
-
- /* Skip not relevant objects */
- if(!preg_match("/".preg_quote($this->dn, '/')."$/i",$obj['dn'])) continue;
+ $res = FAI::get_leaf_objects($this->dn, $this->cn, $this->subClass, get_ou('faiHookRDN'));
+ foreach($res as $obj){
$objects = array();
$objects['status'] = "FreshLoaded";
$objects['dn'] = $obj['dn'];
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc
index bd43bd7691ef0cd824eea945f3eb4240b9b83d81..596e4ba0e3394c04f8849b3a26440e30bffcd2c8 100644 (file)
/* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
*/
- $res = FAI::get_all_objects_for_given_base($this->dn,"(&(objectClass=FAIclass)(objectClass=FAIpartitionDisk))");
+ $res = FAI::get_leaf_objects($this->dn, $this->cn, "FAIpartitionDisk", get_ou('faiPartitionRDN'));
foreach($res as $obj){
-
- /* Skip not relevant objects */
- if(!preg_match("/".preg_quote($this->dn, '/')."$/i",$obj['dn'])) continue;
-
$objects = array();
$objects['description'] = "";
$objects['status'] = "edited";
/* read all partitions for each disk
*/
foreach($this->disks as $name => $disk){
- $res = FAI::get_all_objects_for_given_base($disk['dn'],"(&(objectClass=FAIclass)(objectClass=FAIpartitionEntry))");
- foreach($res as $obj){
-
- /* Skip not relevant objects */
- if(!preg_match("/".preg_quote($disk['dn'], '/')."$/i",$obj['dn'])) continue;
+ $res = FAI::get_leaf_objects($disk['dn'], $name, "FAIpartitionEntry", "cn=".$this->cn.",".get_ou('faiPartitionRDN'));
+ foreach($res as $obj){
$objects = array();
$objects['status'] = "edited";
$objects['dn'] = $obj['dn'];
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiScript.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiScript.inc
index a604bd4b0ddd0b16a8205bb592f62e88850851e7..b2a253e932bbcc0ad1ec42d97faaccc00563562a 100644 (file)
if($dn != "new"){
$this->dn =$dn;
- /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
- */
- $res = FAI::get_all_objects_for_given_base($this->dn,"(&(objectClass=FAIclass)(objectClass=".$this->subClass."))");
- foreach($res as $obj){
-
- /* Skip not relevant objects */
- if(!preg_match("/".preg_quote($this->dn, '/')."$/i",$obj['dn'])) continue;
+ $res = FAI::get_leaf_objects($this->dn, $this->cn, $this->subClass, get_ou('faiScriptRDN'));
+ foreach($res as $obj){
$objects = array();
$objects['status'] = "FreshLoaded";
$objects['dn'] = $obj['dn'];
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiTemplate.inc
index 0b3875d9c8f48de3a7bae44d492041b7d744fac1..689d5464bfa856d6dc395d5a5d2cf95af2ca92a3 100644 (file)
/* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
*/
- $res = FAI::get_all_objects_for_given_base($this->dn,"(&(objectClass=FAIclass)(objectClass=".$this->subClass."))");
+ $res = FAI::get_leaf_objects($this->dn, $this->cn, $this->subClass, get_ou('faiTemplateRDN'));
foreach($res as $obj){
-
- /* Skip not relevant objects */
- if(!preg_match("/".preg_quote($this->dn, '/')."$/i",$obj['dn'])) continue;
-
$objects = array();
$objects['status'] = "FreshLoaded";
$objects['dn'] = $obj['dn'];
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiVariable.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiVariable.inc
index c8d3f21aababfca7e52b1e69dfa79aa53939760d..372dac4dd8aeae457b5484ef46543670df07247f 100644 (file)
/* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
*/
- $res = FAI::get_all_objects_for_given_object($this->dn,"(&(objectClass=FAIclass)(objectClass=".$this->subClass."))");
+ $res = FAI::get_leaf_objects($this->dn, $this->cn, $this->subClass, get_ou('faiVariableRDN'));
foreach($res as $obj){
$objects = array();
$objects['description'] = "";