Code

Added acls to faiSummary tab
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Sep 2006 08:48:26 +0000 (08:48 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Sep 2006 08:48:26 +0000 (08:48 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4724 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiSummaryTab.inc
plugins/admin/fai/faiSummary.tpl

index 0fd878cd38322f2257f013919bd6fa7267fb1e06..0f5f5fcc28571a4e7c56777b746b71ed2d882d99 100644 (file)
@@ -30,9 +30,9 @@ class faiSummaryTab extends plugin{
   var $InitCalled     = false;
   var $usedClasses    = array();
   var $base           = ""; 
-  var $parent         = ""
+  var $parent         = NULL
 
-  function faiSummaryTab($config,$dni,$parent)
+  function faiSummaryTab($config,$dn,$parent)
   {
     plugin::plugin($config,$dn,$parent);
 
@@ -56,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
@@ -82,6 +81,8 @@ class faiSummaryTab extends plugin{
       }
     }
 
+    $tmp = array_flip($this->getBranches());
+
     $this->Classes[] = "LAST";
 
     /* Set all available releases */
@@ -172,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__))));
@@ -211,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);;
@@ -352,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){
 
@@ -527,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"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("workstation","server","fai") ,
+          "plProvidedAcls"=> array(
+            "readable" => _("Viewable")),
+          ));
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 63d9cab084c10c86cbd47d8cc4dde429a33ddda8..196f7cab86f38cc377c0554afa48590d7d439567 100644 (file)
@@ -3,6 +3,8 @@
  <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
   <td style="padding:5px;">{t}FAI object tree{/t}</td>
  </tr>
+
+{if $readable}
  <tr>
        <td style="padding-left:5px;padding-top:5px;padding-bottom:12px;border-bottom:1px solid #B0B0B0">
                <input type="image" src="images/list_reload.png" name="reloadList" class="center">      
  {$objectList}
        </td>
  </tr>
+{else}
+<tr>
+       <td style='padding:6px;'>
+               {t}You are not allowed to view the fai summary.{/t}
+       </td>
+</tr>
+{/if}
 </table>