Changeset 249
- Timestamp:
- 06/08/09 20:51:52 (15 years ago)
- Location:
- LATMOS-Accounts/lib/LATMOS/Accounts
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Group.pm
r218 r249 71 71 q{ 72 72 select value from group_attributes_users 73 join group_attributes_list on74 group_attributes_users.attr = group_attributes_list.ikey75 73 join "group" on "group".ikey = group_attributes_users.okey 76 where name = ? and canonical= ?74 where name = ? and attr = ? 77 75 } 78 76 ); … … 93 91 foreach my $attr (keys %data) { 94 92 $attr =~ /^memberUID|member$/ and do { 95 my $attrid = $self->_get_field_name_db('memberUID', $self->base) or next;96 93 my %member; 97 94 foreach (@{ $self->get_field('memberUID') }) { … … 109 106 q{insert into group_attributes_users (value, attr, okey) values (?,?,?)} 110 107 ); 111 $sth->execute($_, $attrid, $self->_get_ikey);108 $sth->execute($_, 'memberUID', $self->_get_ikey); 112 109 } elsif ($member{$_}{c}) { 113 110 my $sth = $self->db->prepare_cached( 114 111 q{delete from group_attributes_users where value = ? and attr = ? and okey = ?} 115 112 ); 116 $sth->execute($_, $attrid, $self->_get_ikey);113 $sth->execute($_, 'memberUID', $self->_get_ikey); 117 114 } # else {} # can't happend 118 115 } -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r218 r249 86 86 select name from "group" join 87 87 group_attributes_users on group_attributes_users.okey = "group".ikey 88 join group_attributes_list on 89 group_attributes_users.attr = group_attributes_list.ikey 90 where value = ? and canonical = ? 88 where value = ? and attr = ? 91 89 } 92 90 ); … … 102 100 select name from "user" join 103 101 user_attributes on user_attributes.okey = "user".ikey 104 join user_attributes_list 105 on user_attributes_list.ikey = user_attributes.attr 106 where value = ? and canonical = ? 102 where value = ? and attr = ? 107 103 } 108 104 ); … … 118 114 select name from "group" join 119 115 group_attributes on "group".ikey = group_attributes.okey 120 join group_attributes_list on group_attributes_list.ikey = group_attributes.attr121 116 where okey in (select okey from group_attributes_users where value = ?) 122 and canonical= ? and value = ?117 and attr = ? and value = ? 123 118 } 124 119 ); … … 134 129 select name from "group" join 135 130 group_attributes on group_attributes.okey = "group".ikey 136 join group_attributes_list 137 on group_attributes_list.ikey = group_attributes.attr 138 where value = ? and canonical = ? 131 where value = ? and attr = ? 139 132 } 140 133 ); … … 183 176 foreach my $attr (keys %data) { 184 177 $attr =~ /^memberOf$/ and do { 185 my $cl = $self->base->_load_obj_class('group') or next;186 my $attrid = $cl->_get_field_name_db('memberUID', $self->base) or next;187 178 my %member; 188 179 foreach (@{ $self->get_field('memberOf') }) { … … 200 191 q{insert into group_attributes_users (value, attr, okey) values (?,?,?)} 201 192 ); 202 $sth->execute($self->id, $attrid, $group->_get_ikey);193 $sth->execute($self->id, 'memberUID', $group->_get_ikey); 203 194 } elsif ($member{$_}{c}) { 204 195 my $sth = $self->db->prepare_cached( 205 196 q{delete from group_attributes_users where value = ? and attr = ? and okey = ?} 206 197 ); 207 $sth->execute($self->id, $attrid, $group->_get_ikey);198 $sth->execute($self->id, 'memberUID', $group->_get_ikey); 208 199 } # else {} # can't happend 209 200 } -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm
r243 r249 142 142 my $res = $sth->fetchrow_hashref; 143 143 $sth->finish; 144 $res->{ikey}144 return $c_field if($res->{ikey}); 145 145 } 146 146 -
LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm
r205 r249 6 6 use base qw(Config::IniFiles); 7 7 use LATMOS::Accounts::Bases; 8 use LATMOS::Accounts::Log; 8 9 9 10 =head1 NAME … … 143 144 ); 144 145 if (defined $res) { 145 warn sprintf(146 "%s::%s::%s => %s (%s) \n",146 la_log(LA_INFO, 147 "%s::%s::%s => %s (%s)", 147 148 $self->from->label, $otype, $uid, 148 149 $destbase->label, $res 149 150 ) if ($res); 150 151 } else { 151 warn sprintf(152 "Error syncing %s::%s::%s => %s \n",152 la_log(LA_ERR, 153 "Error syncing %s::%s::%s => %s", 153 154 $self->from->label, $otype, $uid, $destbase->label 154 155 ); … … 172 173 print "delete " . $destbase->label . '::' . $otype . '::' . "$_\n"; 173 174 } else { 174 warn "cannot delete " . $destbase->label . '::' . $otype . '::' . "$_\n";175 la_log(LA_ERR, "cannot delete " . $destbase->label . '::' . $otype . '::' . "$_"); 175 176 } 176 177 } … … 183 184 my ($self, $otype, $uid) = @_; 184 185 my $sobj = $self->from->get_object($otype, $uid) or do { 185 warn "Cannot get object for synching $uid ($otype)\n";186 la_log(LA_WARNING, "Cannot get object for synching $uid ($otype)"); 186 187 return; 187 188 }; 188 189 foreach ($self->to) { 189 190 if (my $res = $_->sync_object($sobj)) { 190 warn $_->label . " $uid ($otype) $res\n"; 191 } else { warn "error synching $uid ($otype) to " . $_->label . "\n"; } 191 la_log(LA_INFO, $_->label . " $uid ($otype) $res"); 192 } else { 193 la_log(LA_ERR, "error synching $uid ($otype) to " . $_->label); 194 } 192 195 } 193 196 foreach ($self->to) {
Note: See TracChangeset
for help on using the changeset viewer.