Code

Fixed ogroup saving
[gosa.git] / plugins / admin / fai / class_faiSummaryTab.inc
index d22b1e84c1266e6af4bed04211f18a8e26e49d2a..eba31ee2a38c82469a6ac3a0957e0d6c111fff91 100644 (file)
@@ -29,10 +29,12 @@ class faiSummaryTab extends plugin{
   var $is_dialog      = false;
   var $InitCalled     = false;
   var $usedClasses    = array();
-  
-  function faiSummaryTab($config,$dn)
+  var $base           = ""; 
+  var $parent         = NULL; 
+
+  function faiSummaryTab($config,$dn,$parent)
   {
-    plugin::plugin($config,$dn);
+    plugin::plugin($config,$dn,$parent);
 
     /* Base object configuration */
     $this->objs = array(       
@@ -54,7 +56,6 @@ class faiSummaryTab extends plugin{
     $this->InitCalled = true;
     $this->Result = array();
     $_SESSION['faiSummaryTab']['UniqueID'] = 0; 
-    $tmp = array_flip($this->getBranches());
    
     /* Get classes & release name 
        There are 2 different tabs which use the summary tab
@@ -65,12 +66,14 @@ class faiSummaryTab extends plugin{
       
       /* Get Classes and release */
       $this->Classes = $this->parent->by_object['faiProfile']->FAIclasses;
+      $this->base    = $this->parent->by_object['faiProfile']->base;
       $str = preg_replace("/^.*ou=profiles,/","",$this->dn);
   
     /* Check if parent tab is work tab */
     }elseif(isset($this->parent->by_name['workstartup'])){
       $this->Classes = $this->parent->by_object['workstartup']->FAIclass;
       $this->Release = $this->parent->by_object['workstartup']->FAIrelease;
+      $this->base    = $this->parent->by_object['workgeneric']->base;
 
       /* Append workstation class && LAST */
       if(isset($this->parent->by_object['workgeneric']->cn)){
@@ -78,6 +81,8 @@ class faiSummaryTab extends plugin{
       }
     }
 
+    $tmp = array_flip($this->getBranches());
+
     $this->Classes[] = "LAST";
 
     /* Set all available releases */
@@ -137,7 +142,7 @@ class faiSummaryTab extends plugin{
   function getBranches($base = false,$prefix = "")
   {
     if(!$base){
-      $base = $this->config->current['BASE'];
+      $base = $this->base;
     }
     return(get_all_releases_from_base($base,true));
   }
@@ -168,6 +173,8 @@ class faiSummaryTab extends plugin{
 
     /* Get smarty class & assign created summary results */
     $smarty = get_smarty();
+    $smarty->assign("readable",$this->acl_is_readable("readable"));
+
     $this->ObjectList = $this->createSummary($this->Result);
     $smarty->assign("objectList",$this->ObjectList);
     return($smarty->fetch (get_template_path('faiSummary.tpl', TRUE, dirname(__FILE__))));
@@ -207,17 +214,19 @@ class faiSummaryTab extends plugin{
         if(in_array($key,array("FAItemplate","FAIhook","FAIscript"))){
 
           $nums = array();          
-
+          $tmp  = array();
           if($key == "FAIscript"){
-            foreach($entry['Entries'] as $scripts){
-              foreach($scripts as $script){
-                
-                if(!isset($nums[$script['cn'][0]])){
-                  $nums[$script['cn'][0]]= 0;
-                } 
-                $nums[$script['cn'][0]] ++;
-            
-                $tmp[$script['FAIpriority'][0].$script['cn'][0].$script['CLASS']] = $script;
+            if(is_array($entry['Entries'])){
+              foreach($entry['Entries'] as $scripts){
+                foreach($scripts as $script){
+
+                  if(!isset($nums[$script['cn'][0]])){
+                    $nums[$script['cn'][0]]= 0;
+                  } 
+                  $nums[$script['cn'][0]] ++;
+
+                  $tmp[$script['FAIpriority'][0].$script['cn'][0].$script['CLASS']] = $script;
+                }
               }
             }
             krsort($tmp);;
@@ -348,6 +357,11 @@ class faiSummaryTab extends plugin{
     $dn                    = $this->Releases [$this->Release];
     $resolvedClasses  = get_all_objects_for_given_base($dn,"(&(objectClass=FAIclass)(cn=".$class."))");
 
+    /* Check acls -> are we allowed to view the sonfig summary ? */
+    if(!$this->acl_is_readable("readable")) {
+      return;
+    }
+
     /* Try to fetch all types of fai objects with the given cn  */
     foreach($resolvedClasses as $obj){
 
@@ -523,6 +537,23 @@ class faiSummaryTab extends plugin{
       $this->resolveObject($class);
     }
   }
+
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Summary"),
+          "plDescription" => _("FAI summary"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 15,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("workstation","server","fai") ,
+          "plProvidedAcls"=> array(
+            "readable" => _("Viewable")),
+          ));
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>