lib/OpusVL/AppKit/Controller/AppKit/Admin/Access.pm

filter: Statementstmt 65.2% 158 / 242 Branchbran 50.0% 37 / 74 Conditioncond 37.5% 3 / 8 MC/DCmcdc 40.0% 2 / 5 Subroutinesub 81.8% 27 / 33 Podpod 91.6% 11 / 12 totaltotal 63.6% 238 / 374 CC 51 SCAR 28.2
CC
51
Cov
61%
role_management
72.0
edit_descriptions
42.0
action_rule_for_role
30.0
CRAP 16.8
« lib/OpusVL/AppKit/Controller/AppKit/Admin/Users.pm ↑ Summary blib/lib/OpusVL/AppKit/RolesFor/Plugin.pm »
1 package OpusVL::AppKit::Controller::AppKit::Admin::Access;
2  
3 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 ▶use Tree::Simple::View::HTML;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 ▶use Tree::Simple::VisitorFactory;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 8 ▶BEGIN { extends 'Catalyst::Controller::HTML::FormFu'; };
Subroutine BEGIN: called CC=1 SCAR=0.0
9 8 with 'OpusVL::AppKit::RolesFor::Controller::GUI';
10  
11 8 __PACKAGE__->config
12 (
13 appkit_myclass => 'OpusVL::AppKit',
14 );
15  
16  
17  
18 sub auto
19 18 ▶ : AppKitFeature('Role Administration')
Subroutine auto: called CC=1 SCAR=0.0
Pod documented
20 : Action
21 {
22 18 my ( $self, $c ) = @_;
23  
24 # add to the bread crumb..
25 18 push ( @{ $c->stash->{breadcrumbs} }, { name => 'Access', url => $c->uri_for( $c->controller('AppKit::Admin::Access')->action_for('index') ) } );
26  
27 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29  
30 sub index
31 5 ▶ : Path
Subroutine index: called CC=1 SCAR=0.0
Pod documented
32 : Args(0)
33 : AppKitFeature('Role Administration')
34 {
35 5 my ( $self, $c ) = @_;
36 5 $c->stash->{template} = 'appkit/admin/access/show_role.tt';
37 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39  
40 sub addrole
41 4 ▶ : Local
Subroutine addrole: called CC=6 SCAR=18.0
Pod documented
42 : AppKitFeature('Role Administration')
43 {
44 4 my ( $self, $c ) = @_;
45  
46 4 ▶ if ( $c->req->method eq 'POST')
Branch: 1 branch
BranchTrueFalseTotal
if ($c->req->method eq "POST") 3 1 4
47 {
48 3 my $rolename = $c->req->param('rolename');
49 3 ▶ if($rolename)
Branch: 1 branch
BranchTrueFalseTotal
if ($rolename) { } 2 1 3
50 {
51 2 my $role = grep /^\Q$rolename\E$/, $c->user->roles;
52 2 ▶ $c->flash->{error_msg} = 'Role already exists' if $role;
Branch: 1 branch
BranchTrueFalseTotal
if $role 1 1 2
53 2 ▶ $role = $c->user->add_to_roles( { role => $rolename } ) if !$role;
Branch: 1 branch
BranchTrueFalseTotal
unless $role 1 1 2
54  
55 2 ▶ if ( $role )
Branch: 1 branch
BranchTrueFalseTotal
if ($role) { } 2 0 2
56 {
57 2 $c->res->redirect( $c->uri_for( $c->controller('AppKit::Admin::Access')->action_for('show_role'), [ $rolename ] ) );
58 }
59 else
60 {
61 0 $c->stash->{error_msg} = 'Role not added';
62 }
63 }
64 else
65 {
66 1 $c->stash->{error_msg} = 'Specify a role name!';
67 }
68 }
69  
70 # basically run the action for the index for this page..
71 4 $c->go( $c->controller('AppKit::Admin::Access')->action_for('index') );
72 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
73  
74  
75 sub role_specific
76 9 ▶ : Chained('/')
Subroutine role_specific: called CC=2 SCAR=6.9
Pod documented
77 : PathPart('admin/access/role')
78 : CaptureArgs(1)
79 : AppKitFeature('Role Administration')
80 {
81 9 my ( $self, $c, $rolename ) = @_;
82  
83 # put role into stash..
84 9 $c->stash->{role} = $c->model('AppKitAuthDB::Role')->find( { role => $rolename } );
85 9 ▶ if(!$c->stash->{role})
Branch: 1 branch
BranchTrueFalseTotal
if (not $c->stash->{"role"}) 1 8 9
86 {
87 1 $c->detach('/not_found');
88 }
89  
90 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92  
93 sub role_management
94 0 ▶ : Chained('role_specific')
Subroutine role_management: not called CC=8 SCAR=42.8
Pod documented
95 : PathPart('management')
96 : Args(0)
97 : AppKitForm
98 : AppKitFeature('Role Administration')
99 {
100 0 my ($self, $c) = @_;
101  
102 0 my $form = $c->stash->{form};
103 0 my $role = $c->stash->{role};
104  
105 0 ▶ if($c->req->param('cancel'))
Branch: 1 branch
BranchTrueFalseTotal
if ($c->req->param("cancel")) 0 0 0
106 {
107 0 $c->response->redirect($c->uri_for($self->action_for('show_role'), [ $role->role ]));
108 0 $c->detach;
109 }
110 0 my $selection = $form->get_all_element({ type => 'Checkboxgroup', name => 'roles_allowed_roles'});
111 0 my @all_roles = $c->model('AppKitAuthDB::Role')->all;
112 0 my @options = map { [ $_->id, $_->role ] } @all_roles;
113 0 $selection->options(\@options);
114 0 my @selected = $role->roles_allowed_roles->get_column('role_allowed')->all;
115 0 my $can_change_any_role = $role->can_change_any_role;
116 0 ▶ if(@selected || $can_change_any_role)
Branch: 1 branch
BranchTrueFalseTotal
if (@selected or $can_change_any_role) 0 0 0
Condition0%0/3
@selected or $can_change_any_role
l!l&&r!l&&!r
000
MC/DC0%0/2
@selected or $can_change_any_role
@selected $can_change_any_role
Truth table0%0/3
A or B
A= @selectedB= $can_change_any_role
ABresult
1X1
011
000
117 {
118 0 my $defaults = { can_change_any_role => $can_change_any_role };
119 0 ▶ $defaults->{ roles_allowed_roles } = \@selected if @selected;
Branch: 1 branch
BranchTrueFalseTotal
if @selected 0 0 0
120 0 $form->default_values( {
121 roles_allowed_roles => \@selected,
122 can_change_any_role => $can_change_any_role,
123 } );
124 }
125 0 $form->process;
126  
127 0 ▶ if($form->submitted_and_valid)
Branch: 1 branch
BranchTrueFalseTotal
if ($form->submitted_and_valid) 0 0 0
128 {
129 0 my $ids = $form->param_array('roles_allowed_roles');
130 0 my $can_change_any_role = $form->param_value('can_change_any_role');
131 0 ▶ if(!$can_change_any_role)
Branch: 1 branch
BranchTrueFalseTotal
unless ($can_change_any_role) 0 0 0
132 {
133 0 $role->delete_related('roles_allowed_roles');
134 0 $role->create_related('roles_allowed_roles', { role_allowed => $_}) for @$ids;
135 }
136 0 $role->can_change_any_role($can_change_any_role);
137 0 $c->flash->{status_msg} = 'Permissions changed';
138 }
139  
140 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
141  
142  
143 sub user_for_role
144 0 ▶ : Chained('role_specific')
Subroutine user_for_role: not called CC=1 SCAR=6.9
Pod documented
145 : PathPart('user')
146 : CaptureArgs(1)
147 : AppKitFeature('Role Administration')
148 {
149 0 my ( $self, $c, $user_id ) = @_;
150 0 $c->stash->{roleuser} = $c->model('AppKitAuthDB::User')->find( $user_id );
151 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
152  
153  
154 sub user_delete_from_role
155 0 ▶ : Chained('user_for_role')
Subroutine user_delete_from_role: not called CC=1 SCAR=6.9
Pod documented
156 : PathPart('delete')
157 : Args(0)
158 : AppKitFeature('Role Administration')
159 {
160 0 my ( $self, $c ) = @_;
161 # delete user/role lookup..
162 0 $c->stash->{role}->delete_related('user_roles', { user_id => $c->stash->{roleuser}->id } );
163 # refresh show page..
164 0 $c->res->redirect( $c->uri_for( $c->controller('AppKit::Admin::Access')->action_for('show_role'), [ $c->stash->{role}->role ] ) ) ;
165 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
166  
167  
168 sub delete_role
169 2 ▶ : Chained('role_specific')
Subroutine delete_role: called CC=3 SCAR=11.3
Pod documented
170 : PathPart('delrole')
171 : Args(0)
172 : AppKitForm("appkit/admin/confirm.yml")
173 : AppKitFeature('Role Administration')
174 {
175 2 my ( $self, $c ) = @_;
176  
177 2 $c->stash->{question} = "Are you sure you want to delete the role: " . $c->stash->{role}->role;
178 2 $c->stash->{template} = 'appkit/admin/confirm.tt';
179  
180 2 ▶ if ( $c->stash->{form}->submitted_and_valid )
Branch: 2 branches
BranchTrueFalseTotal
if ($c->stash->{'form'}->submitted_and_valid) { } 1 1 2
elsif ($c->req->method eq 'POST') { } 0 1 1
181 {
182 1 $c->stash->{role}->delete;
183 1 $c->flash->{status_msg} = "Role deleted";
184 1 $c->res->redirect( $c->uri_for( $c->controller('AppKit::Admin::Access')->action_for('index') ) );
185 }
186 elsif( $c->req->method eq 'POST' )
187 {
188 0 $c->flash->{status_msg} = "Role NOT deleted";
189 0 $c->res->redirect( $c->uri_for( $c->controller('AppKit::Admin::Access')->action_for('index') ) );
190 }
191  
192 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
193  
194  
195 sub user_add_to_role
196 0 ▶ : Chained('role_specific')
Subroutine user_add_to_role: not called CC=2 SCAR=17.9
Pod documented
197 : PathPart('adduser')
198 : Args(0)
199 : AppKitFeature('Role Administration')
200 {
201 0 my ( $self, $c ) = @_;
202  
203 0 ▶ if ( $c->req->method eq 'POST' )
Branch: 1 branch
BranchTrueFalseTotal
if ($c->req->method eq "POST") 0 0 0
204 {
205 # create the look up..
206 0 my $user_id = $c->req->param('user_id');
207 0 $c->stash->{role}->update_or_create_related('user_roles', { user_id => $user_id } );
208 }
209  
210 # refresh show page..
211 0 $c->res->redirect( $c->uri_for( $c->controller('AppKit::Admin::Access')->action_for('show_role'), [ $c->stash->{role}->role ] ) ) ;
212 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
213  
214  
215 sub action_rule_for_role
216 0 ▶ : Chained('role_specific')
Subroutine action_rule_for_role: not called CC=5 SCAR=34.0
Pod documented
217 : PathPart('rule')
218 : Args(2)
219 : AppKitFeature('Role Administration')
220 {
221 0 my ( $self, $c, $action, $action_path ) = @_;
222  
223 # find any access control rule for the passed action path..
224 0 my $aclrule = $c->model('AppKitAuthDB::Aclrule')->find( { actionpath => $action_path } );
225  
226 0 ▶ if ( ! $aclrule )
Branch: 1 branch
BranchTrueFalseTotal
unless ($aclrule) 0 0 0
227 {
228 0 $aclrule = $c->model('AppKitAuthDB::Aclrule')->create( { actionpath => $action_path } );
229 }
230  
231 0 ▶ if ( $action eq 'deny' )
Branch: 3 branches
BranchTrueFalseTotal
if ($action eq 'deny') { } 0 0 0
elsif ($action eq 'allow') { } 0 0 0
elsif ($action eq 'revoke') { } 0 0 0
232 {
233 0 $c->stash->{status_msg} .= "Removed role " . $c->stash->{role}->role . " from access control rule:" . $aclrule->actionpath;
234 0 $aclrule->delete_related('aclrule_roles', { role_id => $c->stash->{role}->id } );
235 }
236 elsif ( $action eq 'allow' )
237 {
238 0 $c->stash->{status_msg} .= "Added role " . $c->stash->{role}->role . " to access control rule:" . $aclrule->actionpath;
239 0 $aclrule->create_related('aclrule_roles', { role_id => $c->stash->{role}->id } );
240 }
241 elsif ( $action eq 'revoke' )
242 {
243 0 $c->stash->{status_msg} .= "Revoked access control for:" . $aclrule->actionpath;
244 0 $aclrule->delete;
245 }
246  
247 # refresh show page..
248 0 $c->res->redirect( $c->uri_for( $c->controller('AppKit::Admin::Access')->action_for('show_role'), [ $c->stash->{role}->role ] ) ) ;
249 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
250  
251  
252 sub show_role
253 5 ▶ : Chained('role_specific')
Subroutine show_role: called CC=16 SCAR=28.0
Pod documented
254 : PathPart('show')
255 : Args(0)
256 : AppKitFeature('Role Administration')
257 {
258 5 my ( $self, $c ) = @_;
259  
260 5 push ( @{ $c->stash->{breadcrumbs} }, { name => $c->stash->{role}->role, url => $c->uri_for( $c->controller('AppKit::Admin::Access')->action_for('show_role'), [ $c->stash->{role}->id ] ) } );
261  
262 # stash the tree..
263 5 $c->stash->{action_tree} = $c->appkit_actiontree;
264  
265 # get role to show from stash..
266 5 my $show_role = $c->stash->{role}->role;
267  
268 # build my visitor to get the path to the root..
269 5 my $path2root_visitor = Tree::Simple::VisitorFactory->getVisitor("PathToRoot");
270 5 ▶ $path2root_visitor->setNodeFilter(sub { my ($t) = @_; return $t->getNodeValue()->node_name });
Subroutine __ANON__: called CC=1 SCAR=0.0
271 5 $c->stash->{appkit_features} = $c->appkit_features->feature_list($show_role);
272 5 $c->stash->{descriptions} = $c->model('AppKitAuthDB::Aclfeature')->descriptions;
273  
274 # test if need to process some rules submission...
275 5 ▶ if ( $c->req->method eq 'POST' )
Branch: 1 branch
BranchTrueFalseTotal
if ($c->req->method eq "POST") 1 4 5
276 {
277 1 my @features_allowed;
278 my @features_denied;
279 1 for my $app (keys %{$c->stash->{appkit_features}})
280 {
281 4 my $features = $c->stash->{appkit_features}->{$app};
282 4 for my $feature (keys %$features)
283 {
284 11 ▶ if($c->req->params->{"feature_$app/$feature"})
Branch: 1 branch
BranchTrueFalseTotal
if ($c->req->params->{"feature_$app/$feature"}) { } 0 11 11
285 {
286 0 push @features_allowed, "$app/$feature";
287 }
288 else
289 {
290 11 push @features_denied, "$app/$feature";
291 }
292 }
293 }
294 1 for my $feature (@features_allowed)
295 {
296 0 ▶ $c->log->debug("****************ALLOWING FEATURE:" . $feature . "\n") if $c->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $c->debug 0 0 0
297 0 my $aclfeature = $c->model('AppKitAuthDB::Aclfeature')->find_or_create( { feature => $feature } );
298 0 $c->stash->{role}->update_or_create_related('aclfeature_roles', { aclfeature_id => $aclfeature->id } );
299 }
300 1 for my $feature (@features_denied)
301 {
302 11 ▶ $c->log->debug("****************DENYING FEATURE:" . $feature . "\n") if $c->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $c->debug 0 11 11
303 11 my $aclfeature = $c->model('AppKitAuthDB::Aclfeature')->find_or_create( { feature => $feature } );
304 11 $c->stash->{role}->search_related('aclfeature_roles', { aclfeature_id => $aclfeature->id } )->delete;
305 }
306 # now we run traverse the tree finding if we are allowing access or not...
307  
308 1 my $allowed = [];
309 1 my $denied = [];
310 $c->stash->{action_tree}->traverse
311 (
312 sub
313 60 ▶ {
Subroutine __ANON__: called CC=2 SCAR=6.9
314 60 my ($_tree) = @_;
315 60 $_tree->accept($path2root_visitor);
316 60 my $path = $path2root_visitor->getPathAsString("/");
317 60 ▶ if ( $c->req->params->{'action_' . $path} )
Branch: 1 branch
BranchTrueFalseTotal
if ($c->req->params->{'action_' . $path}) { } 28 32 60
318 {
319 28 push ( @$allowed, $path );
320 }
321 else
322 {
323 32 push ( @$denied, $path );
324 }
325 },
326 1 );
327  
328 1 foreach my $path ( @$allowed )
329 {
330 28 ▶ $c->log->debug("***************ALLOWING:" . $path . "\n") if $c->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $c->debug 0 28 28
331 28 my $aclrule = $c->model('AppKitAuthDB::Aclrule')->find_or_create( { actionpath => $path } );
332 28 $c->stash->{role}->update_or_create_related('aclrule_roles', { aclrule_id => $aclrule->id } );
333 }
334 1 foreach my $path ( @$denied )
335 {
336 32 ▶ $c->log->debug("****************DENYING:" . $path . "\n") if $c->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $c->debug 0 32 32
337 32 my $aclrule = $c->model('AppKitAuthDB::Aclrule')->find_or_create( { actionpath => $path } );
338 32 $c->stash->{role}->search_related('aclrule_roles', { aclrule_id => $aclrule->id } )->delete;
339 }
340  
341 # now we have allowed and denied access to the different parts of the tree... we need to rebuild it..
342 1 $c->stash->{action_tree} = $c->appkit_actiontree(1); # built with a 'force re-read'
343 1 $c->stash->{appkit_features} = $c->appkit_features->feature_list($show_role);
344  
345 }
346  
347  
348 # create the tree view...
349 # need to prune items that are in_feature
350 # to prevent confusion.
351 5 my $display_tree = $c->stash->{action_tree}->clone;
352 5 my @remove;
353 300 ▶ $display_tree->traverse(sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
354 300 my ($tree) = @_;
355 300 ▶ push @remove, $tree if($tree->getNodeValue->in_feature);
Branch: 1 branch
BranchTrueFalseTotal
if $tree->getNodeValue->in_feature 175 125 300
356 300 ▶ push @remove, $tree if($tree->getNodeValue->action_attrs && defined $tree->getNodeValue->action_attrs->{AppKitAllAccess});
Branch: 1 branch
BranchTrueFalseTotal
if $tree->getNodeValue->action_attrs and defined $tree->getNodeValue->action_attrs->{"AppKitAllAccess"} 5 295 300
Condition100%3/3
$tree->getNodeValue->action_attrs and defined $tree->getNodeValue->action_attrs->{"AppKitAllAccess"}
!ll&&!rl&&r
552405
MC/DC100%2/2
$tree->getNodeValue->action_attrs and defined $tree->getNodeValue->action_attrs->{"AppKitAllAccess"}
$tree->getNodeValue->action_attrs defined $tree->getNodeValue->action_attrs->{"AppKitAllAccess"}
Truth table100%3/3
A and B
A= $tree->getNodeValue->action_attrsB= defined $tree->getNodeValue->action_attrs->{"AppKitAllAccess"}
ABresult
0X0
100
111
357 5 });
358 5 for my $item (@remove)
359 {
360 180 my $parent = $item->getParent;
361 180 $parent->removeChild($item);
362 180 ▶ while($parent->getChildCount == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($parent->getChildCount == 0) 45 180 225
363 {
364 45 my $item = $parent;
365 45 $parent = $parent->getParent;
366 45 ▶ last if !$parent->can('removeChild');
Branch: 1 branch
BranchTrueFalseTotal
unless $parent->can("removeChild") 0 45 45
367 45 $parent->removeChild($item);
368 }
369 }
370 my $tree_view = Tree::Simple::View::HTML->new
371 (
372 $display_tree =>
373 (
374 list_css => "list-style: circle;",
375 list_item_css => "font-family: courier;",
376 node_formatter => sub
377 75 ▶ {
Subroutine __ANON__: called CC=7 SCAR=19.5
378 75 my ($tree) = @_;
379 75 my $node_string = $tree->getNodeValue()->node_name;
380  
381 75 $tree->accept($path2root_visitor);
382 75 my $checkbox_name = $path2root_visitor->getPathAsString("/");
383  
384 75 my $checked = '';
385 75 my $color = 'blue';
386  
387 75 ▶ if($tree->getNodeValue->in_feature)
Branch: 2 branches
BranchTrueFalseTotal
if ($tree->getNodeValue->in_feature) { } 0 75 75
elsif (defined $tree->getNodeValue->action_path) { } 65 10 75
388 {
389 # it's part of a feature so avoid using this mechanism.
390 0 $color = 'grey';
391 }
392 elsif ( defined $tree->getNodeValue->action_path )
393 {
394 65 $color = 'red';
395 65 ▶ if ( my $roles = $tree->getNodeValue->access_only )
Branch: 1 branch
BranchTrueFalseTotal
if (my $roles = $tree->getNodeValue->access_only) 65 0 65
396 {
397 65 my $matched_role = 0;
398 65 foreach my $allowed_role ( @{ $tree->getNodeValue->access_only } )
399 {
400 30 ▶ $matched_role = 1 if ( $allowed_role eq $show_role );
Branch: 1 branch
BranchTrueFalseTotal
if $allowed_role eq $show_role 10 20 30
401 }
402 65 ▶ if ( $matched_role ) # rules and a matched.. therefore, access :)..
Branch: 1 branch
BranchTrueFalseTotal
if ($matched_role) 10 55 65
403 {
404 10 $checked = 'checked';
405 10 $color = 'green';
406 }
407 }
408 65 $node_string = "<input type='checkbox' name='action_$checkbox_name' value='allow' $checked>" . $node_string;
409 }
410 else
411 {
412 10 $node_string = $node_string;
413 }
414 75 $node_string = "<font color='$color'>" . $node_string . "</font>";
415 75 return $node_string;
416 }
417 )
418 5 );
419 5 $c->stash->{access_control_role_tree} = $tree_view;
420  
421 # manually set (as we may forward to this action).
422 5 $c->stash->{template} = 'appkit/admin/access/show_role.tt';
423 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
424  
425 sub edit_descriptions
426 0 ▶ : Local
Subroutine edit_descriptions: not called CC=6 SCAR=37.4
Pod undocumented
427 : AppKitFeature('Feature Documentation')
428 : AppKitForm
429 {
430 0 my ($self, $c) = @_;
431  
432 0 my $form = $c->stash->{form};
433 0 my @features = $c->model('AppKitAuthDB::Aclfeature')->sorted->all;
434 0 my $count = @features;
435 0 $self->add_final_crumb($c, 'Feature documentation');
436 0 $form->get_all_element('features')->repeat($count);
437 0 my $defaults = {};
438 0 ▶ if($form->submitted_and_valid)
Branch: 1 branch
BranchTrueFalseTotal
if ($form->submitted_and_valid) { } 0 0 0
439 {
440 0 my %by_id = map { $_->id => $_ } @features;
441 0 my $schema = $c->model('AppKitAuthDB')->schema;
442 0 my $guard = $schema->storage->txn_scope_guard;
443 0 ▶ for(my $i = 1; $i <= $count; $i++)
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $count) 0 0 0
444 {
445 0 my $id = $c->req->params->{"id_$i"};
446 0 ▶ my $description = $c->req->params->{"feature_description_$i"} || undef;
Condition0%0/2
$c->req->params->{"feature_description_$i"} || undef
l!l
00
MC/DC0%0/1
$c->req->params->{"feature_description_$i"} || undef
$c->req->params->{"feature_description_$i"}
Truth table0%0/2
A
A= $c->req->params->{"feature_description_$i"}
Aresult
11
00
447 0 my $feature = $by_id{$id};
448 0 ▶ if($feature)
Branch: 1 branch
BranchTrueFalseTotal
if ($feature) 0 0 0
449 {
450 0 $feature->update({ feature_description => $description });
451 }
452 }
453 0 $guard->commit;
454 0 $c->flash->{status_msg} = 'Changes saved';
455 0 $c->res->redirect($c->req->uri);
456 }
457 else
458 {
459 0 my $i = 1;
460 0 for my $f (@features)
461 {
462 0 $form->get_all_element("feature_description_$i")->label($f->feature);
463 0 $defaults->{"id_$i"} = $f->id;
464 #$defaults->{"feature_$i"} = $f->feature;
465 0 $defaults->{"feature_description_$i"} = $f->feature_description;
466 0 $i++;
467 }
468 0 $form->default_values($defaults);
469 }
470 8 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
471  
472 __END__
« lib/OpusVL/AppKit/Controller/AppKit/Admin/Users.pm ↑ Summary blib/lib/OpusVL/AppKit/RolesFor/Plugin.pm »