lib/OpusVL/AppKit/RolesFor/Schema/AppKitAuthDB/Result/Role.pm

filter: Statementstmt 100% 18 / 18 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 96.6% 29 / 30 CC 4 SCAR 10.0
CC
4
Cov
96%
can_change_any_role
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« blib/lib/OpusVL/AppKit/Plugin/AppKit/FeatureList.pm ↑ Summary lib/OpusVL/AppKit/Controller/Root.pm »
1 package OpusVL::AppKit::RolesFor::Schema::AppKitAuthDB::Result::Role;
2  
3 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6  
7 sub setup_authdb
8 {
9 12 ▶ my $class = shift;
Subroutine setup_authdb: called CC=1 SCAR=0.0
Pod documented
10  
11 12 $class->many_to_many( users => 'users_roles', 'user');
12 12 $class->many_to_many( aclrules => 'aclrule_roles', 'aclrule_id');
13  
14 }
15  
16  
17 sub can_change_any_role
18 {
19 46 ▶ my $self = shift;
Subroutine can_change_any_role: called CC=4 SCAR=13.9
Pod documented
20 46 ▶ if(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 3 43 46
21 {
22 # set it
23 3 ▶ if(shift)
Branch: 1 branch
BranchTrueFalseTotal
if (shift()) { } 2 1 3
24 {
25 2 ▶ if($self->search_related('role_admin')->count == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->search_related("role_admin")->count == 0) 2 0 2
26 {
27 2 $self->create_related('role_admin', {});
28 }
29 2 $self->delete_related('roles_allowed_roles');
30 }
31 else
32 {
33 1 $self->delete_related('role_admin');
34 }
35 }
36 else
37 {
38 # return it.
39 43 return $self->search_related('role_admin')->count > 0;
40 }
41 }
42  
43 13 1;
44  
45 __END__
46  
47 =pod
48  
49 =encoding UTF-8
50  
51 =head1 NAME
52  
53 OpusVL::AppKit::RolesFor::Schema::AppKitAuthDB::Result::Role
54  
55 =head1 VERSION
56  
57 version 2.24
58  
59 =head2 setup_authdb
60  
61 =head2 can_change_any_role
62  
63 Set the a flag to indicate the role is allowed to modify any other role.
64  
65 =head1 AUTHOR
66  
67 OpusVL - www.opusvl.com
68  
69 =head1 COPYRIGHT AND LICENSE
70  
71 This software is copyright (c) 2010 by OpusVL - www.opusvl.com.
72  
73 This is free software; you can redistribute it and/or modify it under
74 the same terms as the Perl 5 programming language system itself.
75  
76 =cut
« blib/lib/OpusVL/AppKit/Plugin/AppKit/FeatureList.pm ↑ Summary lib/OpusVL/AppKit/Controller/Root.pm »