Code

Fixed some undefined index and implode warnings
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 7 Apr 2010 13:28:12 +0000 (13:28 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 7 Apr 2010 13:28:12 +0000 (13:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17522 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_acl.inc

index a3283dfa26e43deb868ee6aa7f3421b8edff474d..0658fea10ed4dcabfc87129d7b8f852ab46eaa24 100644 (file)
@@ -401,6 +401,9 @@ class acl extends plugin
       if(isset($_POST['selected_role']) && $_POST['aclType'] == 'role'){
         $this->aclContents = "";
         $this->aclContents = base64_decode($_POST['selected_role']);
+      }else{
+          if(is_string($this->aclContents))
+              $this->aclContents = array();
       }
     }
 
@@ -526,59 +529,63 @@ class acl extends plugin
 
     if ($this->dialogState == 'create'){
 
-        // Create a map of all used sections, this allows us to simply hide the remove button 
-        //  if no acl is configured for the given section 
-        // e.g. ';all;department/country;users/user;
-        $usedList = ";".implode(array_keys($this->aclContents),';').";";
-
-        /* Add settings for all categories to the (permanent) list */
-        $data = $lData = array();
-        foreach ($this->aclObjects as $section => $dsc){
-            $summary= "";
-            foreach($this->ocMapping[$section] as $oc){
-                if (isset($this->aclContents[$oc]) && 
-                        count($this->aclContents[$oc]) && 
-                        isset($this->aclContents[$oc][0]) &&
-                        $this->aclContents[$oc][0] != ""){
-
-                    $summary.= "$oc, ";
-                    continue;
-                }
-                if (isset($this->aclContents["$section/$oc"]) && 
-                        count($this->aclContents["$section/$oc"])){
-                    $summary.= "$oc, ";
-                    continue;
-                }
-                if (isset($this->aclContents[$oc]) && 
-                        !isset($this->aclContents[$oc][0]) && 
-                        count($this->aclContents[$oc])){
-                    $summary.= "$oc, ";
+
+        if($this->aclType != 'role'){
+
+            // Create a map of all used sections, this allows us to simply hide the remove button 
+            //  if no acl is configured for the given section 
+            // e.g. ';all;department/country;users/user;
+            $usedList = ";".implode(array_keys($this->aclContents),';').";";
+
+            /* Add settings for all categories to the (permanent) list */
+            $data = $lData = array();
+            foreach ($this->aclObjects as $section => $dsc){
+                $summary= "";
+                foreach($this->ocMapping[$section] as $oc){
+                    if (isset($this->aclContents[$oc]) && 
+                            count($this->aclContents[$oc]) && 
+                            isset($this->aclContents[$oc][0]) &&
+                            $this->aclContents[$oc][0] != ""){
+
+                        $summary.= "$oc, ";
+                        continue;
+                    }
+                    if (isset($this->aclContents["$section/$oc"]) && 
+                            count($this->aclContents["$section/$oc"])){
+                        $summary.= "$oc, ";
+                        continue;
+                    }
+                    if (isset($this->aclContents[$oc]) && 
+                            !isset($this->aclContents[$oc][0]) && 
+                            count($this->aclContents[$oc])){
+                        $summary.= "$oc, ";
+                    }
                 }
-            }
 
-            /* Set summary... */
-            if ($summary == ""){
-                $summary= '<i>'._("No ACL settings for this category!").'</i>';
-            } else {
-                $summary= trim($summary,", ");
-                $summary= " ".sprintf(_("Contains ACLs for these objects: %s"), $summary);
-            }
+                /* Set summary... */
+                if ($summary == ""){
+                    $summary= '<i>'._("No ACL settings for this category!").'</i>';
+                } else {
+                    $summary= trim($summary,", ");
+                    $summary= " ".sprintf(_("Contains ACLs for these objects: %s"), $summary);
+                }
 
-            $actions ="";
-            if($this->acl_is_readable("")){
-                $actions.= image('images/lists/edit.png','cat_edit_'.$section, 
-                        msgPool::editButton(_("category ACL")));
+                $actions ="";
+                if($this->acl_is_readable("")){
+                    $actions.= image('images/lists/edit.png','cat_edit_'.$section, 
+                            msgPool::editButton(_("category ACL")));
+                }
+                if($this->acl_is_removeable() && preg_match("/;".$section."(;|\/)/", $usedList)){
+                    $actions.= image('images/lists/trash.png','cat_del_'.$section, 
+                            msgPool::delButton(_("category ACL")));
+                }   
+                $data[] = $section;
+                $lData[] = array('data'=>array($dsc, $summary, $actions));
             }
-            if($this->acl_is_removeable() && preg_match("/;".$section."(;|\/)/", $usedList)){
-                $actions.= image('images/lists/trash.png','cat_del_'.$section, 
-                        msgPool::delButton(_("category ACL")));
-            }   
-            $data[] = $section;
-            $lData[] = array('data'=>array($dsc, $summary, $actions));
+            $this->sectionList->setListData($data,$lData);
+            $this->sectionList->update();
+            $smarty->assign("aclList", $this->sectionList->render());
         }
-        $this->sectionList->setListData($data,$lData);
-        $this->sectionList->update();
-        $smarty->assign("aclList", $this->sectionList->render());
     
       $smarty->assign("aclType", $this->aclType);
       $smarty->assign("aclFilter", $this->aclFilter);