Code

Reworked filter for primary groups to hide them explicitly when the "show primary...
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Jun 2005 08:03:39 +0000 (08:03 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Jun 2005 08:03:39 +0000 (08:03 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@910 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/class_groupManagement.inc

index 113fd9c6a46ef73361a71f399ab88891f953ab2f..d9463cc1e10873e5822feafb104dfeae4a33bb9f 100644 (file)
@@ -315,7 +315,6 @@ class groupManagement extends plugin
     $error= $ldap->error;
     while ($attrs= $ldap->fetch()){
       $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0];
-      $primarie[$attrs['dn']]= $attrs['cn'][0];
     }
 
     if ($groupfilter['primarygroups'] == "checked"){
@@ -324,26 +323,28 @@ class groupManagement extends plugin
         $filter.= "(gidNumber=$gidNumber)";
       }
       $filter.= "))";
-    }else{
-      $filter.= "(&(objectClass=posixGroup)(&";
+    } else {
+      $filter.= "(&(objectClass=posixGroup)(!(|";
       foreach ($primaries as $gidNumber => $cn){
-        $filter.= "(!gidNumber=$gidNumber)";
+        $filter.= "(gidNumber=$gidNumber)";
       }
-      $filter.= "))";
+      $filter.= ")))";
     }
+
   
     /* Set filter depending on selection */
+    $sfilter= "";
     if ($groupfilter['appgroups'] == "checked"){
       $filter.= "(objectClass=gosaApplicationGroup)";
     }
     if ($this->config->current['SAMBAVERSION'] == 3){
-      $sfilter= "(objectClass=sambaGroupMapping)";
-      if ($groupfilter['sambagroups'] == "checked"){
+      if ($groupfilter['primarygroups'] != "checked"){
+        $sfilter= "(objectClass=sambaGroupMapping)";
+      } elseif ($groupfilter['sambagroups'] == "checked"){
         $filter.= "(objectClass=sambaGroupMapping)";
       }
-    } else {
-      $sfilter= "";
     }
+
     if ($groupfilter['mailgroups'] == "checked"){
       $filter.= "(objectClass=gosaMailAccount)";
     }
@@ -390,12 +391,6 @@ class groupManagement extends plugin
       }
     }
 
-   if($groupfilter['primarygroups']!="checked"){
-      foreach($primarie as $rm ){
-        unset($this->grouplist[$rm]);
-      }
-   } 
-
     natcasesort ($this->grouplist);
     reset ($this->grouplist);
   }