Ignore:
Timestamp:
05/23/09 04:52:03 (15 years ago)
Author:
nanardon
Message:
  • change db structure again
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r159 r163  
    7474        my $sth = $self->db->prepare_cached( 
    7575            q{ 
    76             select value from user_attributes_groups 
    77             join user_attributes_list on 
    78             user_attributes_groups.attr = user_attributes_list.ikey 
    79             where id = ? and canonical = ? 
     76            select id from group_attributes_users 
     77            join group_attributes_list on 
     78            group_attributes_users.attr = group_attributes_list.ikey 
     79            where value = ? and canonical = ? 
    8080            } 
    8181        ); 
    82         $sth->execute($self->id, 'memberOf'); 
     82        $sth->execute($self->id, 'memberUID'); 
    8383        my @res; 
    8484        while (my $res = $sth->fetchrow_hashref) { 
    85             push(@res, $res->{value}); 
     85            push(@res, $res->{id}); 
    8686        } 
    8787        return \@res; 
     
    124124    foreach my $attr (keys %data) { 
    125125        $attr =~ /^memberOf$/ and do { 
    126             my $attrid = $self->_get_field_name_db('memberOf', $self->base) or next; 
     126            my $cl = $self->base->_load_obj_class('group') or next; 
     127            my $attrid = $cl->_get_field_name_db('memberUID', $self->base) or next; 
    127128            my %member; 
    128129            foreach (@{ $self->get_field('memberOf') }) { 
     
    138139                if ($member{$_}{n}) { 
    139140                    my $sth = $self->db->prepare_cached( 
    140                         q{insert into user_attributes_groups (id, attr, value) values (?,?,?)} 
     141                        q{insert into group_attributes_users (value, attr, id) values (?,?,?)} 
    141142                    ); 
    142143                    $sth->execute($self->id, $attrid, $_); 
    143144                } elsif ($member{$_}{c}) { 
    144145                    my $sth = $self->db->prepare_cached( 
    145                         q{delete from user_attributes_groups where id = ? and attr = ? and value = ?} 
     146                        q{delete from group_attributes_users where value = ? and attr = ? and id = ?} 
    146147                    ); 
    147148                    $sth->execute($self->id, $attrid, $_); 
Note: See TracChangeset for help on using the changeset viewer.