PlugAuth/Role/Authz.pm

filter: Statementstmt 44.1% 15 / 34 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 4 / 12 Podpod 100% 8 / 8 totaltotal 43.5% 27 / 62 CC 5 SCAR 17.0
CC
5
Cov
36%
add_user_to_group
12.0
remove_user_from_group
12.0
create_group
2.0
CRAP 5.5
« PlugAuth/Role/Auth.pm ↑ Summary PlugAuth/Plugin/Test.pm »
1 package PlugAuth::Role::Authz;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use List::Util qw( uniq );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # ABSTRACT: Role for PlugAuth authorization plugins
9 5 our $VERSION = '0.39'; # VERSION
10  
11  
12 5 requires qw(
13 can_user_action_resource
14 match_resources
15 host_has_tag
16 actions
17 groups_for_user
18 all_groups
19 users_in_group
20 );
21  
22  
23 0 ▶sub create_group { 0 }
Subroutine create_group: not called CC=1 SCAR=6.9
Pod documented
24  
25  
26 0 ▶sub delete_group { 0 }
Subroutine delete_group: not called CC=1 SCAR=6.9
Pod documented
27  
28  
29 0 ▶sub grant { 0 }
Subroutine grant: not called CC=1 SCAR=6.9
Pod documented
30  
31  
32 0 ▶sub revoke { 0 }
Subroutine revoke: not called CC=1 SCAR=6.9
Pod documented
33  
34  
35 0 ▶sub granted { [] }
Subroutine granted: not called CC=1 SCAR=6.9
Pod documented
36  
37  
38 0 ▶sub update_group { 0 }
Subroutine update_group: not called CC=1 SCAR=6.9
Pod documented
39  
40  
41 sub add_user_to_group
42 0 ▶{
Subroutine add_user_to_group: not called CC=3 SCAR=24.8
Pod documented
43 0 my($self, $group, $user) = @_;
44 0 my $users = $self->users_in_group($group);
45 0 ▶ return 0 unless defined $users;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $users 0 0 0
46 0 push @$users, $user;
47 0 $users = join(',', uniq @$users);
48 0 ▶ return $self->update_group($group, $users) ? $users : ();
Branch: 1 branch
BranchTrueFalseTotal
$self->update_group($group, $users) ? : 0 0 0
49 }
50  
51  
52 sub remove_user_from_group
53 0 ▶{
Subroutine remove_user_from_group: not called CC=3 SCAR=24.8
Pod documented
54 0 my($self, $group, $user) = @_;
55 0 my $users = $self->users_in_group($group);
56 0 ▶ return 0 unless defined $users;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $users 0 0 0
57 0 @$users = grep { lc $_ ne lc $user } @$users;
58 0 $users = join(',', uniq @$users);
59 0 ▶ return $self->update_group($group, $users) ? $users : ();
Branch: 1 branch
BranchTrueFalseTotal
$self->update_group($group, $users) ? : 0 0 0
60 }
61  
62 5 1;
63  
64 __END__
« PlugAuth/Role/Auth.pm ↑ Summary PlugAuth/Plugin/Test.pm »