source: server/trunk/web/lib/Sophie.pm @ 68

Last change on this file since 68 was 65, checked in by nanardon, 14 years ago
  • manage user role
File size: 2.6 KB
Line 
1package Sophie;
2use Moose;
3use namespace::autoclean;
4use Catalyst::Runtime 5.80;
5use Sophie::Base;
6
7# Set flags and add plugins for the application
8#
9#         -Debug: activates the debug mode for very useful log messages
10#   ConfigLoader: will load the configuration from a Config::General file in the
11#                 application's home directory
12# Static::Simple: will serve static files from the application's root
13#                 directory
14
15use Catalyst qw/
16    ConfigLoader
17    Static::Simple
18    Session
19    Session::Store::DBI
20    Session::State::Cookie
21    Compress::Zlib
22    Server
23    Server::XMLRPC
24    Authentication
25    Authorization::Roles
26/;
27
28use RPC::XML;
29$RPC::XML::FORCE_STRING_ENCODING = 1;
30
31extends 'Catalyst';
32
33our $VERSION = '0.01';
34$VERSION = eval $VERSION;
35
36# Configure the application.
37#
38# Note that settings in sophie.conf (or other external
39# configuration file that you set up manually) take precedence
40# over this when using ConfigLoader. Thus configuration
41# details given here can function as a default configuration,
42# with an external configuration file acting as an override for
43# local deployment.
44
45__PACKAGE__->config(
46    name => 'Sophie',
47    # Disable deprecated behavior needed by old applications
48    disable_component_resolution_regex_fallback => 1,
49    default_view => 'TT',
50    xmlrpc => {
51        xml_encoding => 'UTF-8',
52    },
53
54    'authentication' => {
55        default_realm => 'members',
56        realms => {
57            members => {
58                credential => {
59                    class => 'Password',
60                    password_field => 'password',
61                    password_type => 'crypted'
62                },
63                store => {
64                    class => 'DBIx::Class',
65                    user_model => 'Base::Users',
66                    role_relation => 'Roles',
67                    role_field => 'rolename',
68                    id_field => 'mail',
69                    # use_userdata_from_session => 1,
70                },
71            },
72        },
73    },
74);
75
76__PACKAGE__->config->{session} = {
77    expires   => 3600,
78    dbi_dbh   => 'Session',
79    dbi_table => 'sessions',
80#    dbi_dsn => 'dbi:Pg:' . $config->{dbconnect},
81#    dbi_user => $config->{dbuser},
82#    dbi_pass => $config->{dbpassword},
83};
84
85# Start the application
86__PACKAGE__->setup();
87
88=head1 NAME
89
90Sophie - Catalyst based application
91
92=head1 SYNOPSIS
93
94    script/sophie_server.pl
95
96=head1 DESCRIPTION
97
98[enter your description here]
99
100=head1 SEE ALSO
101
102L<Sophie::Controller::Root>, L<Catalyst>
103
104=head1 AUTHOR
105
106Olivier Thauvin
107
108=head1 LICENSE
109
110This library is free software. You can redistribute it and/or modify
111it under the same terms as Perl itself.
112
113=cut
114
1151;
Note: See TracBrowser for help on using the repository browser.