| 
									
										
										
										
											2008-11-25 11:01:42 +00:00
										 |  |  | package Hydra; | 
					
						
							| 
									
										
										
										
											2008-10-28 10:19:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | use strict; | 
					
						
							|  |  |  | use warnings; | 
					
						
							| 
									
										
										
										
											2013-01-23 12:41:57 +00:00
										 |  |  | use parent 'Catalyst'; | 
					
						
							| 
									
										
										
										
											2013-03-29 22:57:32 +01:00
										 |  |  | use Moose; | 
					
						
							| 
									
										
										
										
											2013-05-25 15:36:58 -04:00
										 |  |  | use Hydra::Plugin; | 
					
						
							| 
									
										
										
										
											2012-03-13 13:30:41 +01:00
										 |  |  | use Hydra::Model::DB; | 
					
						
							| 
									
										
										
										
											2008-10-28 10:19:31 +00:00
										 |  |  | use Catalyst::Runtime '5.70'; | 
					
						
							| 
									
										
										
										
											2011-11-25 16:44:18 +01:00
										 |  |  | use Catalyst qw/ConfigLoader | 
					
						
							| 
									
										
										
										
											2014-05-01 16:33:25 +02:00
										 |  |  |                 Unicode::Encoding | 
					
						
							| 
									
										
										
										
											2008-10-28 10:19:31 +00:00
										 |  |  |                 Static::Simple | 
					
						
							|  |  |  |                 StackTrace | 
					
						
							| 
									
										
										
										
											2008-11-26 19:48:04 +00:00
										 |  |  |                 Authentication | 
					
						
							| 
									
										
										
										
											2008-11-26 23:25:24 +00:00
										 |  |  |                 Authorization::Roles | 
					
						
							| 
									
										
										
										
											2008-11-26 19:48:04 +00:00
										 |  |  |                 Session | 
					
						
							|  |  |  |                 Session::Store::FastMmap | 
					
						
							|  |  |  |                 Session::State::Cookie | 
					
						
							| 
									
										
										
										
											2021-06-10 17:45:45 -04:00
										 |  |  |                 Captcha | 
					
						
							|  |  |  |                 PrometheusTiny/, | 
					
						
							| 
									
										
										
										
											2013-01-23 12:41:57 +00:00
										 |  |  |                 '-Log=warn,fatal,error'; | 
					
						
							| 
									
										
										
										
											2013-03-29 22:57:32 +01:00
										 |  |  | use CatalystX::RoleApplicator; | 
					
						
							| 
									
										
										
										
											2019-10-13 02:06:36 +02:00
										 |  |  | use YAML qw(LoadFile); | 
					
						
							|  |  |  | use Path::Class 'file'; | 
					
						
							| 
									
										
										
										
											2013-01-23 12:41:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-28 10:19:31 +00:00
										 |  |  | our $VERSION = '0.01'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-18 14:48:40 +00:00
										 |  |  | __PACKAGE__->config( | 
					
						
							| 
									
										
										
										
											2008-11-25 11:01:42 +00:00
										 |  |  |     name => 'Hydra', | 
					
						
							| 
									
										
										
										
											2008-11-28 14:36:04 +00:00
										 |  |  |     default_view => "TT", | 
					
						
							| 
									
										
										
										
											2021-04-15 10:31:41 -04:00
										 |  |  |     'Plugin::Authentication' => { | 
					
						
							| 
									
										
										
										
											2008-11-29 00:04:45 +00:00
										 |  |  |         default_realm => "dbic", | 
					
						
							| 
									
										
										
										
											2021-04-15 10:31:41 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         dbic => { | 
					
						
							|  |  |  |             credential => { | 
					
						
							|  |  |  |                 class => "Password", | 
					
						
							|  |  |  |                 password_field => "password", | 
					
						
							| 
									
										
										
										
											2021-04-15 10:40:55 -04:00
										 |  |  |                 password_type => "self_check", | 
					
						
							| 
									
										
										
										
											2021-04-15 10:31:41 -04:00
										 |  |  |             }, | 
					
						
							|  |  |  |             store => { | 
					
						
							|  |  |  |                 class => "DBIx::Class", | 
					
						
							|  |  |  |                 user_class => "DB::Users", | 
					
						
							|  |  |  |                 role_relation => "userroles", | 
					
						
							|  |  |  |                 role_field => "role", | 
					
						
							| 
									
										
										
										
											2008-11-29 00:04:45 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2021-04-15 10:31:41 -04:00
										 |  |  |         ldap => $ENV{'HYDRA_LDAP_CONFIG'} ? LoadFile( | 
					
						
							|  |  |  |             file($ENV{'HYDRA_LDAP_CONFIG'}) | 
					
						
							|  |  |  |         ) : undef | 
					
						
							| 
									
										
										
										
											2011-09-15 08:27:17 +00:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:23:18 -04:00
										 |  |  |     'Plugin::ConfigLoader' => { | 
					
						
							|  |  |  |         driver => { | 
					
						
							| 
									
										
										
										
											2021-07-26 17:11:21 +00:00
										 |  |  |             'General' => \%Hydra::Config::configGeneralOpts | 
					
						
							| 
									
										
										
										
											2021-07-22 17:23:18 -04:00
										 |  |  |         } | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-06-10 17:45:45 -04:00
										 |  |  |     'Plugin::PrometheusTiny' => { | 
					
						
							|  |  |  |         include_action_labels => 1, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2013-02-25 18:18:05 +01:00
										 |  |  |     'Plugin::Static::Simple' => { | 
					
						
							|  |  |  |         send_etag => 1, | 
					
						
							|  |  |  |         expires => 3600 | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2011-09-15 08:27:17 +00:00
										 |  |  |     'View::JSON' => { | 
					
						
							| 
									
										
										
										
											2013-02-25 21:04:10 +01:00
										 |  |  |         expose_stash => 'json' | 
					
						
							| 
									
										
										
										
											2011-09-15 08:27:17 +00:00
										 |  |  |     }, | 
					
						
							|  |  |  |     'Plugin::Session' => { | 
					
						
							| 
									
										
										
										
											2013-11-06 15:15:35 +01:00
										 |  |  |         expires => 3600 * 24 * 7, | 
					
						
							| 
									
										
										
										
											2015-07-02 01:01:44 +02:00
										 |  |  |         storage => Hydra::Model::DB::getHydraPath . "/www/session_data", | 
					
						
							| 
									
										
										
										
											2013-11-06 15:14:31 +01:00
										 |  |  |         unlink_on_exit => 0 | 
					
						
							| 
									
										
										
										
											2011-09-15 08:27:17 +00:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2013-02-27 18:33:47 +01:00
										 |  |  |     'Plugin::Captcha' => { | 
					
						
							|  |  |  |         session_name => 'hydra-captcha', | 
					
						
							|  |  |  |         new => { | 
					
						
							|  |  |  |             width => 270, | 
					
						
							|  |  |  |             height => 80, | 
					
						
							|  |  |  |             ptsize => 20, | 
					
						
							|  |  |  |             lines => 30, | 
					
						
							|  |  |  |             thickness => 1, | 
					
						
							|  |  |  |             rndmax => 5, | 
					
						
							|  |  |  |             scramble => 1, | 
					
						
							|  |  |  |             #send_ctobg => 1, | 
					
						
							|  |  |  |             bgcolor => '#ffffff', | 
					
						
							| 
									
										
										
										
											2013-03-04 12:16:13 +01:00
										 |  |  |             font => __PACKAGE__->path_to("ttf/StayPuft.ttf"), | 
					
						
							| 
									
										
										
										
											2013-02-27 18:33:47 +01:00
										 |  |  |         }, | 
					
						
							|  |  |  |         create => [ qw/ttf circle/ ], | 
					
						
							|  |  |  |         particle => [ 3500 ], | 
					
						
							|  |  |  |         out => { force => 'jpeg' } | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2008-11-28 14:36:04 +00:00
										 |  |  | ); | 
					
						
							| 
									
										
										
										
											2008-10-28 10:19:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-29 22:57:32 +01:00
										 |  |  | __PACKAGE__->apply_request_class_roles(qw/Catalyst::TraitFor::Request::ProxyBase/); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-25 15:36:58 -04:00
										 |  |  | my $plugins; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | has 'hydra_plugins' => ( | 
					
						
							|  |  |  |     is => 'ro', | 
					
						
							|  |  |  |     default => sub { return $plugins; } | 
					
						
							|  |  |  | ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | after setup_finalize => sub { | 
					
						
							|  |  |  |     my $class = shift; | 
					
						
							| 
									
										
										
										
											2013-07-02 13:54:18 +02:00
										 |  |  |     $plugins = [Hydra::Plugin->instantiate(db => $class->model('DB'), config => $class->config)]; | 
					
						
							| 
									
										
										
										
											2013-05-25 15:36:58 -04:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-28 10:19:31 +00:00
										 |  |  | __PACKAGE__->setup(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 1; |