source: LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Site.pm @ 453

Last change on this file since 453 was 453, checked in by nanardon, 15 years ago
  • manage postalAddress attribute
  • Property svn:keywords set to Id Rev
File size: 2.0 KB
Line 
1package LATMOS::Accounts::Bases::Sql::Site;
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 { 'site' }
40
41sub key_field { 'name' }
42
43sub has_extended_attributes { 1 }
44
45sub _managed_fields {
46    my ($self, $for, $base) = @_;
47    $for !~ /w/ ? (
48        postalAddress => 'postalAddress',
49    ) : ()
50}
51
52
53sub _delayed_fields {
54    my ($self)= @_;
55    return qw();
56}
57
58sub get_field {
59    my ($self, $field) = @_;
60    if ($field eq 'postalAddress' ) {
61        my $bp = $self->_get_c_field('postOfficeBox');
62        return join('$', grep { $_ } (
63            $self->_get_c_field('o'),
64            $self->_get_c_field('streetAddress'),
65            ($bp ? 'BP ' . $bp : ''),
66            join(' ', grep { $_ } (
67                    $self->_get_c_field('postalCode'),
68                    $self->_get_c_field('l'),)),
69            join(' ', grep { $_ } (
70                    $self->_get_c_field('st'),
71                    $self->_get_c_field('c'),),
72            )
73        ));
74    } else {
75        return $self->SUPER::get_field($field);
76    }
77}
78
791;
80
81__END__
82
83=head1 SEE ALSO
84
85=head1 AUTHOR
86
87Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt>
88
89=head1 COPYRIGHT AND LICENSE
90
91Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS
92
93This library is free software; you can redistribute it and/or modify
94it under the same terms as Perl itself, either Perl version 5.10.0 or,
95at your option, any later version of Perl 5 you may have available.
96
97
98=cut
Note: See TracBrowser for help on using the repository browser.