Code

Updated FAI management.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jul 2008 08:04:31 +0000 (08:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jul 2008 08:04:31 +0000 (08:04 +0000)
-Updated FAIstate detection

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11695 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_FAI.inc
gosa-plugins/fai/admin/fai/class_faiManagement.inc

index f935bd4c956cd73ada51e3b25e974d8bcc9059eb..9b25238f752e7cd07c03eb51274781071fa1c598 100644 (file)
@@ -26,7 +26,14 @@ class FAI
 
     /* Collect some basic informations and initialize some variables */ 
     $base_release       = FAI::get_release_dn($Current_DN);
-    $previous_releases  = array_reverse(FAI::             get_previous_releases_of_this_release($base_release,true));
+    $previous_releases  = array_reverse(FAI::get_previous_releases_of_this_release($base_release,true));
+
+    $ldap->cat($base_release);
+    $attrs = $ldap->fetch();
+    $FAIstate = "branch";
+    if(isset($attrs['FAIstate'][0])){
+      $FAIstate = $attrs['FAIstate'][0];
+    }
 
     /* We must also include the given release dn */
     $previous_releases[] = $base_release;
@@ -59,6 +66,18 @@ class FAI
             }
           }
 
+          /* Seems to be an inherited class, apply current FAIstate to this classes 
+           */
+          if(!preg_match("/".normalizePreg($base_release)."$/i",$attr['dn'])){
+            $buffer['FAIstate'] = $FAIstate; 
+          }else{
+
+            /* Seems to be created within this release department.
+               This indicates - it can't be of state "freeze"
+             */              
+            $buffer['FAIstate'] = "branch";
+          }
+
           /* In detailed mode are some additonal informations visible */
           if($detailed){
 
index b2b9a25416c3077e2e01cfa378b01eb7361ecf2e..3e495a9d5afe58c1e00846d2cbb04b9cb9a0ce80 100644 (file)
@@ -1082,16 +1082,6 @@ class faiManagement extends plugin
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
 
-    /* Get release tag 
-       If current release is freezed, all objects are freezed to.
-     */
-    $ldap->cat($base);
-    $release_attrs = $ldap->fetch();
-    $force_freezed = FALSE;
-    if(isset($release_attrs['FAIstate'][0]) && preg_match("/freeze/i",$release_attrs['FAIstate'][0])){
-      $force_freezed = TRUE;
-    }
-
     foreach($tmp as $entry){
 
       /* Get some more informations about the object */ 
@@ -1117,33 +1107,10 @@ class faiManagement extends plugin
           $obj['dn']                         = $object['dn'];
           $obj['acl']                      = $acl;
           $obj['class']                          = $rest ['ACL'];
+          $obj['FAIstate']      = $entry['FAIstate'];
           $obj['description']   = $object['description'][0];
           $obj['objectClass']   = $object['objectClass'];
 
-          /* Append type to this string, to be able to check if the selected 
-           * entry is of type 'freeze' or 'branch'
-           */
-#          if(!isset($object['FAIstate'])){
-            
-            /* Is this entry inherited from an earlier release? 
-               In this case inherit the FAIstate from the release container.
-               If this is a newly created entry (allow_freeze_object_attach == TRUE) 
-                then allow to edit this entry by setting its FAIstate manually to branch. 
-             */
-            if($this->allow_freeze_object_attach && preg_match("/".normalizePreg($this->fai_release)."$/i",$object['dn'])){
-              $obj['FAIstate'] = "branch|overridden_by_management_reload";
-            }else{
-              $obj['FAIstate'] = $this->lock_type;
-            }
-  
-#          }else{
-#            $obj['FAIstate'] = $object['FAIstate'][0]; 
-#          }
-
-          if($force_freezed && !$this->allow_freeze_object_attach){
-            $obj['FAIstate'] = "freeze";
-          }
-
           $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
           $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
         }