Index: /LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Group.pm
===================================================================
--- /LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Group.pm	(revision 157)
+++ /LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Group.pm	(revision 158)
@@ -69,14 +69,14 @@
             my $sth = $self->db->prepare_cached(
                 q{
-                select "user".uid from users_groups join "user"
-                on users_groups.uid = "user".uidNumber join
-                "group" on "group".gidnumber = users_groups.gid
-                where "group".groupname = ? order by uid
+                select id from user_attributes_groups
+                join user_attributes_list on
+                user_attributes_groups.attr = user_attributes_list.ikey
+                where value = ? and canonical = ?
                 }
             );
-            $sth->execute($self->id);
+            $sth->execute($self->id, 'memberOf');
             my @res;
             while (my $res = $sth->fetchrow_hashref) {
-                push(@res, $res->{uid});
+                push(@res, $res->{id});
             }
             return \@res;
@@ -91,5 +91,6 @@
     foreach my $attr (keys %data) {
         $attr =~ /^memberUID$/ and do {
-            my $gid = $self->get_field('gidnumber') or next;
+            my $cl = $self->base->_load_obj_class('user') or next;
+            my $attrid = $cl->_get_field_name_db('memberOf', $self->base) or next;
             my %member;
             foreach (@{ $self->get_field('memberUID') }) {
@@ -103,15 +104,14 @@
                 $member{$_}{c} && $member{$_}{n} and next; # no change !
                 my $user = $self->base->get_object('user', $_) or next;
-                my $uid = $user->get_field('uidnumber') or next;
                 if ($member{$_}{n}) {
                     my $sth = $self->db->prepare_cached(
-                        q{insert into users_groups (uid, gid) values (?,?)}
+                        q{insert into user_attributes_groups (id, attr, value) values (?,?,?)}
                     );
-                    $sth->execute($uid, $gid);
+                    $sth->execute($_, $attrid, $self->id);
                 } elsif ($member{$_}{c}) {
                     my $sth = $self->db->prepare_cached(
-                        q{delete from users_groups where uid = ? and gid = ?}
+                        q{delete from user_attributes_groups where id = ? and attr = ? and value = ?}
                     );
-                    $sth->execute($uid, $gid);
+                    $sth->execute($_, $attrid, $self->id);
                 } # else {} # can't happend
             }
Index: /LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
===================================================================
--- /LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm	(revision 157)
+++ /LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm	(revision 158)
@@ -74,14 +74,14 @@
         my $sth = $self->db->prepare_cached(
             q{
-            select groupname from users_groups join "user"
-            on users_groups.uid = "user".uidnumber join
-            "group" on "group".gidnumber = users_groups.gid
-            where "user".uid = ? order by groupname
+            select value from user_attributes_groups
+            join user_attributes_list on
+            user_attributes_groups.attr = user_attributes_list.ikey
+            where id = ? and canonical = ?
             }
         );
-        $sth->execute($self->id);
+        $sth->execute($self->id, 'memberOf');
         my @res;
         while (my $res = $sth->fetchrow_hashref) {
-            push(@res, $res->{groupname});
+            push(@res, $res->{value});
         }
         return \@res;
@@ -124,5 +124,5 @@
     foreach my $attr (keys %data) {
         $attr =~ /^memberOf$/ and do {
-            my $uid = $self->get_field('uidnumber') or next;
+            my $attrid = $self->_get_field_name_db('memberOf', $self->base) or next;
             my %member;
             foreach (@{ $self->get_field('memberOf') }) {
@@ -136,15 +136,14 @@
                 $member{$_}{c} && $member{$_}{n} and next; # no change !
                 my $group = $self->base->get_object('group', $_) or next;
-                my $gid = $group->get_field('gidnumber') or next;
                 if ($member{$_}{n}) {
                     my $sth = $self->db->prepare_cached(
-                        q{insert into users_groups (uid, gid) values (?,?)}
+                        q{insert into user_attributes_groups (id, attr, value) values (?,?,?)}
                     );
-                    $sth->execute($uid, $gid);
+                    $sth->execute($self->id, $attrid, $_);
                 } elsif ($member{$_}{c}) {
                     my $sth = $self->db->prepare_cached(
-                        q{delete from users_groups where uid = ? and gid = ?}
+                        q{delete from user_attributes_groups where id = ? and attr = ? and value = ?}
                     );
-                    $sth->execute($uid, $gid);
+                    $sth->execute($self->id, $attrid, $_);
                 } # else {} # can't happend
             }
