| 1 | package App::LDAP::Command::Add::Group; | ||||||||||||||||||||
| 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 | has base => ( | |||||||||||||||||||
| 11 | is => "rw", | ||||||||||||||||||||
| 12 | isa => "Str", | ||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 1 | has member => ( | |||||||||||||||||||
| 16 | is => "rw", | ||||||||||||||||||||
| 17 | isa => "ArrayRef[Str]", | ||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 1 | ▶ | use App::LDAP::LDIF::Group; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | # {{{ | ||||||||||||||||||||
| 23 | 0 | ▶ | sub run { | ||||||||||||||||||
|
Subroutine
run: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||
| 24 | 0 | my ($self) = shift; | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 0 | my $gid = next_gid(); | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 0 | ▶ | my $groupname = $self->extra_argv->[2] or die "no group name specified"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | die "group $groupname already exists" if App::LDAP::LDIF::Group->search( | ||||||||||||||||||||
| 31 | base => config()->{nss_base_group}->[0], | ||||||||||||||||||||
| 32 | 0 | ▶ | scope => config()->{nss_base_group}->[1], | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 33 | filter => "cn=$groupname", | ||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | my $group = App::LDAP::LDIF::Group->new( | ||||||||||||||||||||
| 37 | 0 | ▶ | base => $self->base // config()->{nss_base_group}->[0], | ||||||||||||||||||
|
Condition0%0/3
$self->base // config()->{"nss_base_group"}[0]
MC/DC0%0/2
$self->base // config()->{"nss_base_group"}[0]
$self->base
config()->{"nss_base_group"}[0]
Truth table0%0/3
A // B
A= $self->baseB= config()->{"nss_base_group"}[0]
| |||||||||||||||||||||
| 38 | cn => [$groupname], | ||||||||||||||||||||
| 39 | gidNumber => $gid->get_value("gidNumber"), | ||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | ▶ | $group->memberUid( $self->member ) if $self->member; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 0 | $group->save; | |||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | $gid->replace(gidNumber => $gid->get_value("gidNumber")+1)->update(ldap()); | |||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 0 | $group; | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | # }}} | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 0 | ▶ | sub next_gid { | ||||||||||||||||||
|
Subroutine
next_gid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 53 | ldap()->search( | ||||||||||||||||||||
| 54 | base => config()->{base}, | ||||||||||||||||||||
| 55 | 0 | filter => "(objectClass=gidnext)", | |||||||||||||||||||
| 56 | )->entry(0); | ||||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||
| 60 | 1 | ▶ | no Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 1 | 1; | |||||||||||||||||||