]> ruin.nu Git - ndwebbie.git/blob - lib/NDWeb.pm
952f87272c3bc666a297d3947f90647def3b8a1e
[ndwebbie.git] / lib / NDWeb.pm
1 package NDWeb;
2
3 use strict;
4 use warnings;
5
6 use Catalyst::Runtime 5.80;
7
8 # Set flags and add plugins for the application
9 #
10 #         -Debug: activates the debug mode for very useful log messages
11 #   ConfigLoader: will load the configuration from a Config::General file in the
12 #                 application's home directory
13 # Static::Simple: will serve static files from the application's root
14 #                 directory
15
16 use parent qw/Catalyst/;
17 use Catalyst qw/
18         -Debug
19         ConfigLoader
20         Static::Simple
21         Unicode
22
23         Authentication
24         Authentication::Store::NDWeb
25         Authentication::Credential::Password
26
27         Authorization::Roles
28         Authorization::ACL
29
30         Session::DynamicExpiry
31         Session
32         Session::Store::File
33         Session::State::Cookie
34
35         Compress::Gzip
36         Compress::Deflate
37
38         Cache
39         PageCache
40 /;
41
42 our $VERSION = '0.01';
43
44 sub signal_bots {
45         system 'killall','-USR1', 'ndbot.pl';
46 }
47
48 # Configure the application.
49 #
50 # Note that settings in ndweb.yml (or other external
51 # configuration file that you set up manually) take precedence
52 # over this when using ConfigLoader. Thus configuration
53 # details given here can function as a default configuration,
54 # with an external configuration file acting as an override for
55 # local deployment.
56
57 __PACKAGE__->config( name => 'NDWeb' );
58 __PACKAGE__->config->{'Plugin::Authentication'}{'use_session'} = 1;
59 __PACKAGE__->config(session => {
60         storage => "/tmp/ndweb-$>/session",
61         directory_umask => 077,
62         expires => 300,
63         verify_address => 1,
64 });
65 __PACKAGE__->config( cache => {
66         backend => {
67                 class => "Cache::FileCache",
68                 cache_root => "/tmp/ndweb-$>",
69                 namespace => "cache",
70                 default_expires_in => 3600,
71                 directory_umask => 077,
72         },
73 });
74
75 __PACKAGE__->config( page_cache => {
76         set_http_headers => 1,
77         disable_index => 1,
78 });
79
80 __PACKAGE__->config( default_model => 'Model');
81 # Start the application
82 __PACKAGE__->setup();
83
84 __PACKAGE__->deny_access_unless('/users',[qw/admin_users/]);
85 __PACKAGE__->deny_access_unless('/alliances',[qw/alliances/]);
86 __PACKAGE__->deny_access_unless('/alliances/resources',[qw/alliances_resources/]);
87 __PACKAGE__->deny_access_unless('/graphs/alliancevsintel',[qw/graphs_intel/]);
88 __PACKAGE__->deny_access_unless('/graphs/avgalliancevsintel',[qw/graphs_intel/]);
89 __PACKAGE__->deny_access_unless('/members',[qw/members/]);
90 __PACKAGE__->deny_access_unless('/members/defenders',[qw/members_defenders/]);
91 __PACKAGE__->deny_access_unless('/covop',[qw/covop/]);
92 __PACKAGE__->deny_access_unless('/calls',[qw/calls_edit/]);
93 __PACKAGE__->allow_access_if('/calls/index',[qw/calls_list/]);
94 __PACKAGE__->allow_access_if('/calls/list',[qw/calls_list/]);
95 __PACKAGE__->allow_access_if('/calls/edit',[qw/members/]);
96 __PACKAGE__->allow_access_if('/calls/findCall',[qw/members/]);
97 __PACKAGE__->deny_access_unless('/raids',[qw/raids_edit/]);
98 __PACKAGE__->allow_access_if('/raids/index',[qw//]);
99 __PACKAGE__->allow_access_if('/raids/view',[qw//]);
100 __PACKAGE__->allow_access_if('/raids/targetcalc',[qw//]);
101 __PACKAGE__->allow_access_if('/raids/fleetcalc',[qw//]);
102 __PACKAGE__->allow_access_if('/raids/calcredir',[qw//]);
103 __PACKAGE__->allow_access_if('/raids/findRaid',[qw//]);
104 __PACKAGE__->allow_access_if('/raids/log',[qw//]);
105 __PACKAGE__->deny_access_unless('/intel',[qw/intel/]);
106 __PACKAGE__->deny_access_unless('/intel/members',[qw/intel_members/]);
107 __PACKAGE__->deny_access_unless('/intel/member',[qw/intel_member/]);
108 __PACKAGE__->deny_access_unless('/intel/naps',[qw/intel_naps/]);
109 __PACKAGE__->deny_access_unless('/jsrpc',[qw//]);
110 __PACKAGE__->allow_access_if('/jsrpc/end',1);
111 __PACKAGE__->deny_access_unless('/forum/allUnread',[qw//]);
112 __PACKAGE__->deny_access_unless('/forum/privmsg',[qw//]);
113 __PACKAGE__->deny_access_unless('/settings',[qw//]);
114 __PACKAGE__->deny_access_unless('/textexport/alliance',[qw/textexport_alliance/]);
115
116 =head1 NAME
117
118 NDWeb - Catalyst based application
119
120 =head1 SYNOPSIS
121
122     script/ndweb_server.pl
123
124 =head1 DESCRIPTION
125
126 [enter your description here]
127
128 =head1 SEE ALSO
129
130 L<NDWeb::Controller::Root>, L<Catalyst>
131
132 =head1 AUTHOR
133
134 Catalyst developer
135
136 =head1 LICENSE
137
138 This library is free software. You can redistribute it and/or modify
139 it under the same terms as Perl itself.
140
141 =cut
142
143 1;