source: LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm @ 68

Last change on this file since 68 was 68, checked in by nanardon, 15 years ago
  • more attributes supported
  • Property svn:keywords set to Id Rev
File size: 1.7 KB
Line 
1package LATMOS::Accounts::Bases::Sql::User;
2
3use 5.010000;
4use strict;
5use warnings;
6
7use base qw(LATMOS::Accounts::Bases::Sql::objects);
8
9our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0];
10
11=head1 NAME
12
13LATMOS::Ad - Perl extension for blah blah blah
14
15=head1 SYNOPSIS
16
17  use LATMOS::Accounts::Bases;
18  my $base = LATMOS::Accounts::Bases->new('sql');
19  ...
20
21=head1 DESCRIPTION
22
23Account base access over standard unix file format.
24
25=head1 FUNCTIONS
26
27=cut
28
29=head2 new(%options)
30
31Create a new LATMOS::Ad object for windows AD $domain.
32
33domain / server: either the Ad domain or directly the server
34
35ldap_args is an optionnal list of arguments to pass to L<Net::LDAP>.
36
37=cut
38
39sub object_table { 'person' }
40
41sub key_field { 'login' }
42
43sub _inline_fields {
44    my ($self, $for) = @_;
45    my %fields = (
46        uidNumber       => 'uid',
47        gidNumber       => 'gid',
48        (($for !~ /w/)
49        ? (
50            gecos        => 'gecos',
51            sAMAccountName  => 'sAMAccountName',
52            uid          => 'login',
53        )
54        : ()),
55    );
56    \%fields
57}
58
59sub get_field {
60    my ($self, $field) = @_;
61    if ($field eq 'gecos') {
62        return join(' ', map { $_ || '' } ($self->get_c_field('givenName'), ($self->get_c_field('sn'))));
63    } elsif ($field =~ /^(sAMAccountName|login)$/) {
64        return $self->{id},
65    } else {
66        return $self->SUPER::get_field($field);
67    }
68}
69
701;
71
72__END__
73
74=head1 SEE ALSO
75
76=head1 AUTHOR
77
78Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt>
79
80=head1 COPYRIGHT AND LICENSE
81
82Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS
83
84This library is free software; you can redistribute it and/or modify
85it under the same terms as Perl itself, either Perl version 5.10.0 or,
86at your option, any later version of Perl 5 you may have available.
87
88
89=cut
Note: See TracBrowser for help on using the repository browser.