Changeset 163 for LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
- Timestamp:
- 05/23/09 04:52:03 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r159 r163 74 74 my $sth = $self->db->prepare_cached( 75 75 q{ 76 select value from user_attributes_groups77 join user_attributes_list on78 user_attributes_groups.attr = user_attributes_list.ikey79 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 = ? 80 80 } 81 81 ); 82 $sth->execute($self->id, 'member Of');82 $sth->execute($self->id, 'memberUID'); 83 83 my @res; 84 84 while (my $res = $sth->fetchrow_hashref) { 85 push(@res, $res->{ value});85 push(@res, $res->{id}); 86 86 } 87 87 return \@res; … … 124 124 foreach my $attr (keys %data) { 125 125 $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; 127 128 my %member; 128 129 foreach (@{ $self->get_field('memberOf') }) { … … 138 139 if ($member{$_}{n}) { 139 140 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 (?,?,?)} 141 142 ); 142 143 $sth->execute($self->id, $attrid, $_); 143 144 } elsif ($member{$_}{c}) { 144 145 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 = ?} 146 147 ); 147 148 $sth->execute($self->id, $attrid, $_);
Note: See TracChangeset
for help on using the changeset viewer.