[94] | 1 | package LATMOS::Accounts::Web; |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
[923] | 5 | no utf8; |
---|
[94] | 6 | |
---|
| 7 | use Catalyst::Runtime '5.70'; |
---|
| 8 | |
---|
| 9 | # Set flags and add plugins for the application |
---|
| 10 | # |
---|
| 11 | # -Debug: activates the debug mode for very useful log messages |
---|
| 12 | # ConfigLoader: will load the configuration from a YAML file in the |
---|
| 13 | # application's home directory |
---|
| 14 | # Static::Simple: will serve static files from the application's root |
---|
| 15 | # directory |
---|
| 16 | |
---|
[221] | 17 | use Catalyst qw/ |
---|
| 18 | ConfigLoader |
---|
| 19 | Static::Simple |
---|
| 20 | Session |
---|
| 21 | Session::State::Cookie |
---|
[1157] | 22 | Session::Store::File |
---|
[229] | 23 | Authentication |
---|
[1546] | 24 | I18N |
---|
[221] | 25 | /; |
---|
[94] | 26 | |
---|
[2202] | 27 | our $VERSION = '6.0.0'; |
---|
[1435] | 28 | |
---|
[94] | 29 | # Configure the application. |
---|
[2162] | 30 | __PACKAGE__->config( |
---|
| 31 | encoding => 'UTF-8', |
---|
| 32 | 'Plugin::I18N' => { |
---|
| 33 | 'maketext_options' => { |
---|
| 34 | Decode => 1 |
---|
| 35 | } |
---|
| 36 | } |
---|
| 37 | ); |
---|
[94] | 38 | |
---|
[1148] | 39 | # Default value for active/inactive features |
---|
[923] | 40 | __PACKAGE__->config( |
---|
[1148] | 41 | features => { |
---|
| 42 | # /services/mailing, mass mailing |
---|
| 43 | mailing => 0, |
---|
| 44 | # /summary/offices |
---|
| 45 | offices_list => 0, |
---|
| 46 | # /summary/department |
---|
| 47 | departments_list => 0, |
---|
| 48 | # users/address forms |
---|
| 49 | user_addresses => 1, |
---|
| 50 | # users/email form |
---|
| 51 | user_email => 1, |
---|
| 52 | # users/my form |
---|
| 53 | user_my => 1, |
---|
[1500] | 54 | # user status managed by employment |
---|
| 55 | user_employment => 0, |
---|
[2197] | 56 | # others informations about user |
---|
| 57 | user_add => 0, |
---|
[1148] | 58 | } |
---|
| 59 | ); |
---|
| 60 | |
---|
[1586] | 61 | __PACKAGE__->config( |
---|
| 62 | objects => { |
---|
| 63 | user => { |
---|
| 64 | quick_search => [ qw(cn sn givenName description comment uidNumber) ], |
---|
| 65 | list => [ qw(sn givenName mail) ], |
---|
| 66 | }, |
---|
| 67 | group => { |
---|
| 68 | quick_search => [ qw(cn description comment gidNumber) ], |
---|
| 69 | list => [ qw(description) ], |
---|
| 70 | }, |
---|
| 71 | nethost => { |
---|
[2061] | 72 | quick_search => [ qw(cn description ip cname otherName macaddr serialNumber inventoryNumber) ], |
---|
[1586] | 73 | list => [ qw(description owner) ], |
---|
| 74 | }, |
---|
| 75 | netzone => { |
---|
| 76 | quick_search => [ qw(cn description ip) ], |
---|
| 77 | list => [ qw(type description) ], |
---|
| 78 | }, |
---|
| 79 | site => { |
---|
| 80 | quick_search => [ qw(cn l) ], |
---|
| 81 | list => [ qw(l) ], |
---|
| 82 | }, |
---|
| 83 | aliases => { |
---|
| 84 | quick_search => [ qw(name) ], |
---|
| 85 | list => [ qw() ], |
---|
| 86 | }, |
---|
| 87 | }, |
---|
| 88 | ); |
---|
| 89 | |
---|
[861] | 90 | my $config_file = '/etc/latmos-accounts/latmos-accounts-web.yml'; |
---|
| 91 | if (-r $config_file ) { |
---|
| 92 | __PACKAGE__->config( 'Plugin::ConfigLoader' => { |
---|
| 93 | file => $config_file |
---|
| 94 | } |
---|
| 95 | ); |
---|
| 96 | } |
---|
| 97 | |
---|
[605] | 98 | # http://stackoverflow.com/questions/1664816/is-there-a-way-to-force-c-urifor-in-catalyst-to-generate-a-uri-that-begins-wit |
---|
| 99 | __PACKAGE__->config( using_frontend_proxy => 1 ); |
---|
| 100 | |
---|
[94] | 101 | __PACKAGE__->config( name => 'LATMOS::Accounts::Web' ); |
---|
| 102 | |
---|
[229] | 103 | __PACKAGE__->config->{'Plugin::Authentication'} = { |
---|
[889] | 104 | default_realm => 'la', |
---|
[229] | 105 | realms => { |
---|
| 106 | la => { |
---|
| 107 | credential => { |
---|
| 108 | class => 'La' |
---|
| 109 | }, |
---|
| 110 | store => { |
---|
| 111 | class => 'Null', |
---|
| 112 | }, |
---|
| 113 | }, |
---|
| 114 | }, |
---|
| 115 | }; |
---|
| 116 | |
---|
[1534] | 117 | # 1 week for session |
---|
| 118 | __PACKAGE__->config->{'Plugin::Session'} = { |
---|
| 119 | expires => 3600 * 24 * 30 |
---|
| 120 | }; |
---|
[229] | 121 | |
---|
[1534] | 122 | |
---|
[94] | 123 | # Start the application |
---|
| 124 | __PACKAGE__->setup; |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | =head1 NAME |
---|
| 128 | |
---|
| 129 | LATMOS::Accounts::Web - Catalyst based application |
---|
| 130 | |
---|
| 131 | =head1 SYNOPSIS |
---|
| 132 | |
---|
| 133 | script/latmos_accounts_web_server.pl |
---|
| 134 | |
---|
| 135 | =head1 DESCRIPTION |
---|
| 136 | |
---|
| 137 | [enter your description here] |
---|
| 138 | |
---|
| 139 | =head1 SEE ALSO |
---|
| 140 | |
---|
| 141 | L<LATMOS::Accounts::Web::Controller::Root>, L<Catalyst> |
---|
| 142 | |
---|
| 143 | =head1 AUTHOR |
---|
| 144 | |
---|
| 145 | Thauvin Olivier |
---|
| 146 | |
---|
| 147 | =head1 LICENSE |
---|
| 148 | |
---|
| 149 | This library is free software, you can redistribute it and/or modify |
---|
| 150 | it under the same terms as Perl itself. |
---|
| 151 | |
---|
| 152 | =cut |
---|
| 153 | |
---|
| 154 | 1; |
---|