Code

Updated deamon handle
[gosa.git] / gosa-core / include / class_acl.inc
index a9d7bc85dfd0803b1ff5012009c2a61393425faf..5fd4053fcb37f146442ef76f5142ff8ff52f84b3 100644 (file)
@@ -110,7 +110,7 @@ class acl extends plugin
     }
 
     /* Objects */
-    $tmp= get_global('plist');
+    $tmp= session::get('plist');
     $plist= $tmp->info;
     $cats = array();
     if (isset($this->parent) && $this->parent !== NULL){
@@ -206,7 +206,7 @@ class acl extends plugin
     /* Call parent execute */
     plugin::execute();
   
-    $tmp= get_global('plist');
+    $tmp= session::get('plist');
     $plist= $tmp->info;
 
     /* Handle posts */
@@ -431,9 +431,7 @@ class acl extends plugin
             $summary.= "$oc, ";
             continue;
           }
-          if (isset($this->aclContents["$section/$oc"]) && count($this->aclContents["$section/$oc"]) && isset($this->aclContents["$section/$oc"][0]) &&
-              $this->aclContents["$section/$oc"][0] != ""){
-
+          if (isset($this->aclContents["$section/$oc"]) && count($this->aclContents["$section/$oc"])){
             $summary.= "$oc, ";
             continue;
           }
@@ -527,7 +525,7 @@ class acl extends plugin
 
   function sort_by_priority($list)
   {
-    $tmp= get_global('plist');
+    $tmp= session::get('plist');
     $plist= $tmp->info;
     asort($plist);
     $newSort = array();
@@ -584,7 +582,7 @@ class acl extends plugin
   {
     $display= "<input type='hidden' name='acl_dummy_0_0_0' value='1'>";
     $cols= 3;
-    $tmp= get_global('plist');
+    $tmp= session::get('plist');
     $plist= $tmp->info;
     asort($plist);
 
@@ -630,8 +628,15 @@ class acl extends plugin
       }
       $currentAcl= $this->aclContents[$key];
 
+      /* Get the overall plugin acls 
+       */
+      $overall_acl ="";
+      if(isset($currentAcl[0])){
+        $overall_acl = $currentAcl[0];
+      }
+
       /* Object header */
-      if($_SESSION['js']) {
+      if(session::get('js')) {
         if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) {
           $display.= "\n<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2>".
                      "\n  <tr>".
@@ -662,23 +667,23 @@ class acl extends plugin
       /* Generate options */
       $spc= "&nbsp;&nbsp;";
       if ($this->isContainer && $this->aclType != 'base'){
-        $options= $this->mkchkbx($key."_0_c",  _("Create objects"), preg_match('/c/', $currentAcl[0])).$spc;
-        $options.= $this->mkchkbx($key."_0_m", _("Move objects"), preg_match('/m/', $currentAcl[0])).$spc;
-        $options.= $this->mkchkbx($key."_0_d", _("Remove objects"), preg_match('/d/', $currentAcl[0])).$spc;
+        $options= $this->mkchkbx($key."_0_c",  _("Create objects"), preg_match('/c/', $overall_acl)).$spc;
+        $options.= $this->mkchkbx($key."_0_m", _("Move objects"), preg_match('/m/', $overall_acl)).$spc;
+        $options.= $this->mkchkbx($key."_0_d", _("Remove objects"), preg_match('/d/', $overall_acl)).$spc;
         if ($plist[preg_replace('%^.*/%', '', $key)]['plSelfModify']){
-          $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc;
+          $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $overall_acl)).$spc;
         }
       } else {
-        $options= $this->mkchkbx($key."_0_m", _("Move object"), preg_match('/m/', $currentAcl[0])).$spc;
-        $options.= $this->mkchkbx($key."_0_d", _("Remove object"), preg_match('/d/', $currentAcl[0])).$spc;
+        $options= $this->mkchkbx($key."_0_m", _("Move object"), preg_match('/m/', $overall_acl)).$spc;
+        $options.= $this->mkchkbx($key."_0_d", _("Remove object"), preg_match('/d/', $overall_acl)).$spc;
         if ($plist[preg_replace('%^.*/%', '', $key)]['plSelfModify']){
-          $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc;
+          $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $overall_acl)).$spc;
         }
       }
 
       /* Global options */
-      $more_options= $this->mkchkbx($key."_0_r",  _("read"), preg_match('/r/', $currentAcl[0])).$spc;
-      $more_options.= $this->mkchkbx($key."_0_w", _("write"), preg_match('/w/', $currentAcl[0]));
+      $more_options= $this->mkchkbx($key."_0_r",  _("read"), preg_match('/r/', $overall_acl)).$spc;
+      $more_options.= $this->mkchkbx($key."_0_w", _("write"), preg_match('/w/', $overall_acl));
 
       $display.= "\n  <tr>".
                  "\n    <td style='background-color:#E0E0E0' colspan=".($cols-1).">$options</td>".
@@ -689,7 +694,7 @@ class acl extends plugin
       $cnt= 1;
       $splist= $plist[preg_replace('%^.*/%', '', $key)]['plProvidedAcls'];
       asort($splist);
-      if($_SESSION['js']) {
+      if(session::get('js')) {
         if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) {
           $display.= "\n  <tr id='tr_".preg_replace("/[^a-z0-9]/i","_",$name)."' style='vertical-align:top;height:0px;'>".
                      "\n    <td colspan=".$cols.">".
@@ -739,7 +744,7 @@ class acl extends plugin
        $display.= str_repeat("\n    <td style='border-top:1px solid #A0A0A0; width:".(int)(100/$cols)."%'>&nbsp;</td>", $cols-$cnt); 
       }
 
-      if($_SESSION['js']) {
+      if(session::get('js')) {
         if(isset($_SERVER['HTTP_USER_AGENT']) && (preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) || (preg_match("/ie/i",$_SERVER['HTTP_USER_AGENT']))) {
           $display.= "\n        </table>".
                      "\n      </div>".
@@ -798,7 +803,7 @@ class acl extends plugin
         break;
       
       default:
-        print_red(sprintf(_("Unkown ACL type '%s'. Don't know how to handle it."), $type));
+        msg_dialog::display(_("Internal error"), sprintf(_("Unkown ACL type '%s'. Don't know how to handle it."), $type), ERROR_DIALOG);
         $a= array();
     }
     return ($a);