| 1 | package App::LDAP::Command::Del::User; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Modern::Perl; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | with qw( App::LDAP::Role::Command | |||||||||
| 8 | App::LDAP::Role::Bindable ); | ||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use App::LDAP::LDIF::User; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 13 | 0 | my ($self) = shift; | |||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | my $username = $self->extra_argv->[2] or die "no username specified"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | |||||||||||
| 17 | my $user = App::LDAP::LDIF::User->search( | ||||||||||
| 18 | base => config()->{nss_base_passwd}->[0], | ||||||||||
| 19 | 0 | scope => config()->{nss_base_passwd}->[1], | |||||||||
| 20 | filter => "uid=$username", | ||||||||||
| 21 | ); | ||||||||||
| 22 | |||||||||||
| 23 | 0 | $self->delete_group_of_user($user); | |||||||||
| 24 | |||||||||||
| 25 | 0 | $user->delete; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub delete_group_of_user { | ||||||||
|
Subroutine
delete_group_of_user: not called CC=2 SCAR=12.2
Pod
undocumented
| |||||||||||
| 29 | 0 | my ($self, $user) = @_; | |||||||||
| 30 | |||||||||||
| 31 | 0 | my $cn = $user->uid; | |||||||||
| 32 | 0 | my $gidNumber = $user->gidNumber; | |||||||||
| 33 | |||||||||||
| 34 | 1 | ▶ | use App::LDAP::LDIF::Group; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 35 | my $group = App::LDAP::LDIF::Group->search( | ||||||||||
| 36 | base => config()->{nss_base_group}->[0], | ||||||||||
| 37 | 0 | scope => config()->{nss_base_group}->[1], | |||||||||
| 38 | filter => "(& (gidNumber=$gidNumber) (cn=$cn))", | ||||||||||
| 39 | ); | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | $group->delete if $group; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 45 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 46 | |||||||||||
| 47 | 1 | 1; | |||||||||