package LATMOS::Accounts::SynchAccess;

use strict;
use warnings;
use base qw(LATMOS::Accounts::SynchAccess::base);
use LATMOS::Accounts::SynchAccess::Objects;
use LATMOS::Accounts::Log;

our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0];

=head1 NAME

LATMOS::Accounts::SynchAccess

=head1 FUNCTIONS

=cut 

# TODO WTF is difference with LATMOS::Accounts::SynchAccess::base

=head2 get_object ($otype, $uid)

Compatibility function: return a set of object for which action must be done.

=cut

sub get_object {
    my ($self, $otype, $uid) = @_;
    my @subobj;
    foreach ($self->bases) {
        if ($_->is_supported_object($otype)) {
            my $u = $_->get_object($otype, $uid) or do {
                la_log(LA_ERR,
                    "Cannot get object $otype/$uid in %s/%s",
                    $_->type,
                    $_->label
                );
                return;
                };
            push(@subobj, $u);
        }
    }
    return LATMOS::Accounts::SynchAccess::Objects->new(
        [ @subobj ]
    );
}

1;

__END__

=head1 AUTHOR

Olivier Thauvin, E<lt>olivier.thauvin@aerov.jussieu.frE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.

=cut
