Code

Updated copy & paste acls, centralized checks
[gosa.git] / gosa-core / plugins / admin / ogroups / tabs_ogroups.inc
index 5cd066577f8d93129cf50512a8d4cac231f5be24..47af9e79ae6ac30f61ecf813c05d62316ca23f65 100644 (file)
@@ -89,9 +89,11 @@ class ogrouptabs extends tabs
         $this->by_object['workstartup']->remove_from_parent();
         unset($this->by_object['workstartup']);
         unset($this->by_name['workstartup']);
-        $this->by_object['faiSummary']->remove_from_parent();
-        unset($this->by_object['faiSummary']);
-        unset($this->by_name['faiSummary']);
+       if (isset($this->by_object['faiSummary'])){
+               $this->by_object['faiSummary']->remove_from_parent();
+               unset($this->by_object['faiSummary']);
+               unset($this->by_name['faiSummary']);
+       }
       }
     }
   
@@ -177,25 +179,6 @@ class ogrouptabs extends tabs
       }
     }
 
-    /* Add application tab if user or group is member in this object group*/
-    if(class_available("appgroup")){
-      if((preg_match("/G/",$objects) || preg_match("/U/",$objects)) && !isset($this->by_name['appgroup'])){
-        $this->by_name['appgroup']= _("Application");
-        $this->by_object['appgroup']= new appgroup($this->config, $this->dn);
-        $this->by_object['appgroup']->acl = "#all#";
-        $this->by_object['appgroup']->parent= &$this;
-      }
-    }
-
-    /* Remove application tab if not required any longer */
-    if(class_available("appgroup")){
-      if(!preg_match("/G/",$objects) && !preg_match("/U/",$objects) && isset($this->by_name['appgroup'])){
-        $this->by_object['appgroup']->remove_from_parent();
-        unset($this->by_name['appgroup']);
-        unset($this->by_object['appgroup']);
-      }
-    }
-
     /* Add environment tab if user or group is member in this object group*/
     if(class_available("environment")){
       if((preg_match("/G/",$objects) || preg_match("/U/",$objects)) && !isset($this->by_name['environment'])){
@@ -214,6 +197,26 @@ class ogrouptabs extends tabs
         unset($this->by_object['environment']);
       }
     }
+
+    /* Add application tab if user or group is member in this object group*/
+    if(class_available("appgroup")){
+      if((preg_match("/G/",$objects) || preg_match("/U/",$objects)) && !isset($this->by_name['appgroup'])){
+        $this->by_name['appgroup']= _("Applications");
+        $this->by_object['appgroup']= new appgroup($this->config, $this->dn);
+        $this->by_object['appgroup']->acl = "#all#";
+        $this->by_object['appgroup']->parent= &$this;
+      }
+    }
+
+    /* Remove application tab if not required any longer */
+    if(class_available("appgroup")){
+      if(!preg_match("/G/",$objects) && !preg_match("/U/",$objects) && isset($this->by_name['appgroup'])){
+        $this->by_object['appgroup']->remove_from_parent();
+        unset($this->by_name['appgroup']);
+        unset($this->by_object['appgroup']);
+      }
+    }
+
     /* Move reference tab to second position from right */
     if(class_available("acl")){
       if(isset($this->by_name['acl'])){
@@ -277,19 +280,20 @@ class ogrouptabs extends tabs
           case "U":
             /* Append a PhoneQueue, if objectClass = goFonAccount */
             $use = false;
-          foreach($this->by_object['ogroup']->memberList as $dn => $val){
 
-            $obj = $this->by_object['ogroup']->objcache[$dn];
-            
-            if(isset($obj['objectClass'])){
-              if(in_array("goFonAccount",$obj['objectClass'])){
-                $use = true; 
+          /* We found goFonAccount in users objectClasses*/
+          if(class_available("phonequeue")){
+            foreach($this->by_object['ogroup']->memberList as $dn => $val){
+
+              $obj = $this->by_object['ogroup']->objcache[$dn];
+
+              if(isset($obj['objectClass'])){
+                if(in_array("goFonAccount",$obj['objectClass'])){
+                  $use = true; 
+                }
               }
             }
-          }
 
-          /* We found goFonAccount in users objectClasses*/
-          if(class_available("phonequeue")){
             if($use){
               $this->by_name['phonequeue']= _("Phone queue");
               $this->by_object['phonequeue']= new phonequeue($this->config, $this->dn);