| 1 | package PlugAuth::Plugin::DisableGroup; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use 5.010001; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use Role::Tiny::With; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | # ABSTRACT: Disable accounts which belong to a group | ||||||||||||
| 9 | 1 | our $VERSION = '0.39'; # VERSION | |||||||||||
| 10 | |||||||||||||
| 11 | |||||||||||||
| 12 | 1 | with 'PlugAuth::Role::Plugin'; | |||||||||||
| 13 | 1 | with 'PlugAuth::Role::Auth'; | |||||||||||
| 14 | |||||||||||||
| 15 | sub init | ||||||||||||
| 16 | 0 | ▶ | { | ||||||||||
|
Subroutine
init: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 17 | 0 | my($self) = @_; | |||||||||||
| 18 | 0 | ▶ | my $group = $self->{group} = $self->plugin_config->{group} // 'disabled'; | ||||||||||
|
Condition0%0/2
$self->plugin_config->{"group"} // "disabled"
MC/DC0%0/1
$self->plugin_config->{"group"} // "disabled"
$self->plugin_config->{"group"}
Truth table0%0/2
A
A= $self->plugin_config->{"group"}
| |||||||||||||
| 19 | 0 | ▶ | if($self->plugin_config->{disable_on_create}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 20 | { | ||||||||||||
| 21 | 0 | ▶ | $self->app->on(create_user => sub { | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 22 | 0 | my($app, $args) = @_; | |||||||||||
| 23 | 0 | my $user = $args->{user}; | |||||||||||
| 24 | 0 | $app->authz->update_group($group, join(',', @{ $app->authz->users_in_group($group) }, $user)) | |||||||||||
| 25 | 0 | }); | |||||||||||
| 26 | } | ||||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | sub check_credentials | ||||||||||||
| 30 | 0 | ▶ | { | ||||||||||
|
Subroutine
check_credentials: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 31 | 0 | my($self, $user, $pass) = @_; | |||||||||||
| 32 | 0 | my $groups = $self->app->authz->groups_for_user($user); | |||||||||||
| 33 | 0 | ▶ | return 0 unless $groups; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | 0 | ▶ | return 0 if grep { lc($_) eq $self->{group} } @$groups; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | 0 | $self->deligate_check_credentials($user, $pass); | |||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 1 | 1; | |||||||||||
| 39 | |||||||||||||
| 40 | __END__ | ||||||||||||