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