Changeset 2611
- Timestamp:
- 05/13/24 21:16:03 (2 weeks ago)
- Location:
- trunk/LATMOS-Accounts/lib/LATMOS/Accounts
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases.pm
r2597 r2611 1099 1099 $data{$attrname} = $srcobj->GetAttributeValue($srcattrname); 1100 1100 } 1101 if (my $dstobj = $self->get_object($srcobj->type, $srcobj->id)) { 1101 1102 my $KeyAttribute = $self->config( 'keyAttribute.' . $srcobj->base->label . '.' . $srcobj->type ); 1103 1104 my $destid = $options{ KeyAttribute } 1105 ? $srcobj->get_attibutes( $options{ KeyAttribute } ) 1106 : $srcobj->id; 1107 if (my $dstobj = $self->get_object($srcobj->type, $destid)) { 1102 1108 keys %data or return 'SYNCED'; 1103 1109 foreach (keys %data) { -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
r2606 r2611 461 461 } 462 462 463 sub key_field { 464 my ( $self, $otype ) = @_; 465 466 my $pclass = $self->_load_obj_class($otype) or return; 467 return $pclass->_key_field; 468 } 469 463 470 sub current_rev { 464 471 my ($self) = @_; -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r2601 r2611 162 162 }, 163 163 uidnumber => { inline => 1, hide => 1, monitored => 1 }, 164 partageid => { inline => 1, monitored => 1 }, 164 165 gidNumber => { 165 166 inline => 1, -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm
r2607 r2611 52 52 } 53 53 54 # $keyAttribute must be a internal attribute 55 54 56 sub list_from_rev { 55 my ($class, $base, $rev) = @_; 57 my ($class, $base, $rev, $keyAttribute) = @_; 58 defined( $rev ) or die '$rev must be defined when calling list_from_rev()'; 59 $keyAttribute ||= $base->db->quote_identifier($class->_key_field); 56 60 my $sth = $base->db->prepare_cached( 57 61 sprintf( 58 q{select %s as k from %s where rev > ? andinternobject = false59 and oalias IS NULL%s order by %s},60 $ base->db->quote_identifier($class->_key_field),62 q{select %s as k from %s where rev > ? AND internobject = false 63 AND oalias IS NULL AND %s IS NOT NULL %s order by %s}, 64 $keyAttribute, 61 65 $base->db->quote_identifier($class->_object_table), 66 $keyAttribute, 62 67 ($base->{wexported} ? '' : 'and exported = true'), 63 68 $base->db->quote_identifier($class->_key_field), -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/upgrade.pm
r2541 r2611 1521 1521 recompute => 1, 1522 1522 }, 1523 { 1524 ver => 41, 1525 sql => [ 1526 q{ 1527 ALTER TABLE "user" ADD COLUMN partageid TEXT 1528 CREATE INDEX user_partageid_uniqidx 1529 ON partageid 1530 USING btree 1531 (value); 1532 } 1533 ], 1534 }, 1523 1535 ); 1524 1536 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm
r2436 r2611 283 283 $destbase->is_supported_object($otype) or next; 284 284 285 my $SyncKeyAttribute = $self->from->key_field( $otype ); 286 if ( my $attr = $destbase->config( 'keyAttribute.' . $self->from->label . '.' . $otype ) ) { 287 $SyncKeyAttribute = $attr; 288 } 289 285 290 my %existings; 286 291 my %filtering; 287 292 288 293 $existings{$otype} = { map { $_ => 1 } 289 $self->from->list RealObjects($otype) };294 $self->from->list_objects_from_rev( $otype, 0, $SyncKeyAttribute ) }; 290 295 291 296 # Is there a filter to apply: … … 293 298 if (my $filter = $self->{options}->{$filtername}) { 294 299 la_log(LA_DEBUG, "Found %s param, using it: %s", $filtername, $filter); 295 $filtering{$otype} = { map { $_ => 1 } 296 $self->from->search_objects($otype, $filter, 'oalias=NULL') }; 300 foreach ( my $id = $self->from->search_objects($otype, $filter, 'oalias=NULL') ) { 301 my $obj = $self->from->get_object( $otype, $id ); 302 my $id = $obj->get_attributes( $SyncKeyAttribute ); 303 $filtering{$otype}{ $id } = 1; 304 } 297 305 } else { 298 306 $filtering{$otype} = $existings{$otype}; … … 385 393 } 386 394 387 my $res = $destbase->sync_object_from($self->from, $otype, $_, 388 %options, firstpass => $pass); 395 my $res = $destbase->sync_object_from( 396 $self->from, $otype, $_, 397 %options, firstpass => $pass ); 389 398 if (defined $res) { 390 399 if ($res) {
Note: See TracChangeset
for help on using the changeset viewer.