Code

Fixed Copy & Paste group Membership
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Sep 2009 09:33:09 +0000 (09:33 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Sep 2009 09:33:09 +0000 (09:33 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14384 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/posix/class_posixAccount.inc

index 68866fa5b7dcf2ac980b49b5ffe924203f6903c2..3c9e99fbea905a3a9d522c5d07fd3303f5f6aa22 100644 (file)
@@ -1600,6 +1600,22 @@ class posixAccount extends plugin
 #    $this->savedGidNumber = $this->get_next_id("gidNumber", $this->dn);
     $this->savedGidNumber = "";
 
+    /* Get group membership */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=posixGroup)(memberUid=".$source['uid'][0]."))", array("cn", "description"));
+
+    while ($attrs= $ldap->fetch()){
+      if (!isset($attrs["description"][0])){
+        $entry= $attrs["cn"][0];
+      } else {
+        $entry= $attrs["cn"][0]." [".$attrs["description"][0]."]";
+      }
+      $this->groupMembership[$ldap->getDN()]= $entry;
+    }
+    asort($this->groupMembership);
+    reset($this->groupMembership);
+
     /* Fill group */
     if(isset($source['gidNumber'][0])){
       $this->primaryGroup= $source['gidNumber'][0];