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