lib/OpusVL/AppKit/Controller/Root.pm

filter: Statementstmt 96.7% 59 / 61 Branchbran 58.3% 7 / 12 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 16 / 16 Podpod 66.6% 4 / 6 totaltotal 87.0% 87 / 100 CC 8 SCAR 9.3
CC
8
Cov
88%
end
6.5
access_denied
3.0
default
2.0
CRAP 2.5
« lib/OpusVL/AppKit/RolesFor/Schema/AppKitAuthDB/Result/Role.pm ↑ Summary lib/OpusVL/AppKit/View/AppKitTT.pm »
1 package OpusVL::AppKit::Controller::Root;
2  
3  
4 ############################################################################################################
5 10 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 10 ▶BEGIN { extends 'Catalyst::Controller'; }
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 with 'OpusVL::AppKit::RolesFor::Controller::GUI';
10  
11 10 ▶use File::ShareDir ':ALL';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 10 __PACKAGE__->config->{namespace} = '';
14
15 sub auto
16 : Action
17 : AppKitAllAccess
18 {
19 89 ▶ my ( $self, $c ) = @_;
Subroutine auto: called CC=1 SCAR=0.0
Pod documented
20 89 return 1;
21 10 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23  
24 sub index
25 :Path
26 :Args(0)
27 : AppKitFeature('Home Page')
28 {
29 4 ▶ my ( $self, $c ) = @_;
Subroutine index: called CC=1 SCAR=0.0
Pod documented
30  
31 4 $c->_appkit_stash_portlets;
32  
33 4 $c->stash->{template} = 'index.tt';
34 4 $c->stash->{homepage} = 1;
35 10 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37  
38 sub default :Path
39 {
40 2 ▶ my ( $self, $c ) = @_;
Subroutine default: called CC=2 SCAR=7.0
Pod undocumented
41 2 ▶ delete $c->stash->{current_view} if defined $c->stash->{current_view}; # ensure default view.
Branch: 1 branch
BranchTrueFalseTotal
if defined $c->stash->{"current_view"} 0 2 2
42 2 $c->stash->{template} = '404.tt';
43 2 $c->response->status(404);
44 2 $c->stash->{homepage} = 1;
45 2 $c->detach;
46 10 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 sub not_found :Private
49 {
50 1 ▶ my ($self, $c) = @_;
Subroutine not_found: called CC=1 SCAR=0.0
Pod undocumented
51 1 $c->forward('/default');
52 10 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
53  
54 sub access_denied : Private
55 {
56 5 ▶ my ( $self, $c ) = @_;
Subroutine access_denied: called CC=3 SCAR=11.0
Pod documented
57 5 ▶ $c->REST_403 if($c->in_REST_action);
Branch: 1 branch
BranchTrueFalseTotal
if $c->in_REST_action 1 4 5
58 4 $c->stash->{template} = '403.tt';
59 4 ▶ delete $c->stash->{current_view} if defined $c->stash->{current_view}; # ensure default view.
Branch: 1 branch
BranchTrueFalseTotal
if defined $c->stash->{"current_view"} 0 4 4
60 4 $c->response->status(403);
61 4 $c->stash->{homepage} = 1;
62 4 $c->detach('View::AppKitTT');
63 10 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
64  
65  
66 sub end : ActionClass('RenderView')
67 {
68 81 ▶ my ( $self, $c ) = @_;
Subroutine end: called CC=5 SCAR=18.7
Pod documented
69 81 ▶ unless($c->config->{no_clickjack_protection} || $c->stash->{no_clickjack_protection})
Branch: 1 branch
BranchTrueFalseTotal
unless ($c->config->{"no_clickjack_protection"} or $c->stash->{"no_clickjack_protection"}) 81 0 81
Condition33%1/3
$c->config->{"no_clickjack_protection"} or $c->stash->{"no_clickjack_protection"}
l!l&&r!l&&!r
0081
MC/DC0%0/2
$c->config->{"no_clickjack_protection"} or $c->stash->{"no_clickjack_protection"}
$c->config->{"no_clickjack_protection"} $c->stash->{"no_clickjack_protection"}
Truth table33%1/3
A or B
A= $c->config->{"no_clickjack_protection"}B= $c->stash->{"no_clickjack_protection"}
ABresult
1X1
011
000
70 {
71 81 ▶ if($c->config->{clickjack_same_origin})
Branch: 1 branch
BranchTrueFalseTotal
if ($c->config->{'clickjack_same_origin'}) { } 0 81 81
72 {
73 0 $c->response->headers->header( 'X-FRAME-OPTIONS' => 'SAMEORIGIN' );
74 }
75 else
76 {
77 81 $c->response->headers->header( 'X-FRAME-OPTIONS' => 'DENY' );
78 }
79 }
80 81 $c->response->headers->header('X-XSS-Protection' => '1; mode=block');
81 81 ▶ if($c->config->{ssl_only})
Branch: 1 branch
BranchTrueFalseTotal
if ($c->config->{"ssl_only"}) 0 81 81
82 {
83 0 $c->response->headers->header('Strict-Transport-Security' => 'max-age=31536000; includeSubDomains');
84 }
85 81 $c->response->headers->header('X-Content-Type-Options' => 'nosniff');
86 10 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
87  
88 10 1;
89  
90 __END__
91  
92 =pod
93  
94 =encoding UTF-8
95  
96 =head1 NAME
97  
98 OpusVL::AppKit::Controller::Root
99  
100 =head1 VERSION
101  
102 version 2.22
103  
104 =head1 DESCRIPTION
105  
106 The OpusVL::AppKit is intended to be inherited by another Catalyst App using AppBuilder.
107  
108 The current intention is that Apps that use AppKit do not need to have their own Root Controller,
109 but use this one.
110 If you app requires its own Root.pm Controller, you should inherite this one
111  
112 This should provide all the base funcationallity required for delivery of standard sites
113 developed by the OpusVL team.
114  
115 =head1 NAME
116  
117 OpusVL::AppKit::Controller::Root - Root Controller for OpusVL::AppKit
118  
119 =head1 METHODS
120  
121 =head2 auto
122  
123 =head2 index
124 This is intended to be seen as the AppKit home page.
125  
126 =head2 access_notallowed
127 This called by the ACL method when an access control rule is broken. (including not being logged in!)
128 Configured in myapp.conf :
129 <OpusVL::AppKit::Plugin::AppKit>
130 access_denied "access_notallowed"
131 </OpusVL::AppKit::Plugin::AppKit>
132  
133 =head2 end
134 Attempt to render a view, if needed.
135  
136 =head1 AUTHOR
137  
138 OpusVL - www.opusvl.com
139  
140 =head1 COPYRIGHT AND LICENSE
141  
142 This software is copyright (c) 2010 by OpusVL - www.opusvl.com.
143  
144 This is free software; you can redistribute it and/or modify it under
145 the same terms as the Perl 5 programming language system itself.
146  
147 =cut
« lib/OpusVL/AppKit/RolesFor/Schema/AppKitAuthDB/Result/Role.pm ↑ Summary lib/OpusVL/AppKit/View/AppKitTT.pm »