Changeset 163
- Timestamp:
- 05/23/09 04:52:03 (15 years ago)
- Location:
- LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Group.pm
r162 r163 70 70 my $sth = $self->db->prepare_cached( 71 71 q{ 72 select id from user_attributes_groups73 join user_attributes_list on74 user_attributes_groups.attr = user_attributes_list.ikey75 where value= ? and canonical = ?72 select value from group_attributes_users 73 join group_attributes_list on 74 group_attributes_users.attr = group_attributes_list.ikey 75 where id = ? and canonical = ? 76 76 } 77 77 ); 78 $sth->execute($self->id, 'member Of');78 $sth->execute($self->id, 'memberUID'); 79 79 my @res; 80 80 while (my $res = $sth->fetchrow_hashref) { 81 push(@res, $res->{ id});81 push(@res, $res->{value}); 82 82 } 83 83 return \@res; … … 92 92 foreach my $attr (keys %data) { 93 93 $attr =~ /^memberUID$/ and do { 94 my $cl = $self->base->_load_obj_class('user') or next; 95 my $attrid = $cl->_get_field_name_db('memberOf', $self->base) or next; 94 my $attrid = $self->_get_field_name_db('memberUID', $self->base) or next; 96 95 my %member; 97 96 foreach (@{ $self->get_field('memberUID') }) { … … 107 106 if ($member{$_}{n}) { 108 107 my $sth = $self->db->prepare_cached( 109 q{insert into user_attributes_groups (id, attr, value) values (?,?,?)}108 q{insert into group_attributes_users (value, attr, id) values (?,?,?)} 110 109 ); 111 110 $sth->execute($_, $attrid, $self->id); 112 111 } elsif ($member{$_}{c}) { 113 112 my $sth = $self->db->prepare_cached( 114 q{delete from user_attributes_groups where id = ? and attr = ? and value= ?}113 q{delete from group_attributes_users where value = ? and attr = ? and id = ?} 115 114 ); 116 115 $sth->execute($_, $attrid, $self->id); -
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.