File Coverage

blib/lib/App/LDAP/LDIF/Sudoer.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package App::LDAP::LDIF::Sudoer;
2              
3 1     1   6 use Modern::Perl;
  1         2  
  1         8  
4              
5 1     1   567 use Moose;
  0            
  0            
6              
7             extends qw(
8             App::LDAP::ObjectClass::SudoRole
9             App::LDAP::LDIF
10             );
11              
12             around BUILDARGS => sub {
13             my $orig = shift;
14             my $self = shift;
15             push @_, ( dn => "cn=" . {@_}->{sudoUser} . "," . {@_}->{base} ) if grep /^base$/, @_;
16             $self->$orig(@_);
17             };
18              
19             has '+objectClass' => (
20             default => sub {
21             [
22             qw( top
23             sudoRole )
24             ]
25             },
26             );
27              
28             has '+cn' => (
29             lazy => 1,
30             default => sub {
31             [shift->sudoUser]
32             },
33             );
34              
35             has '+sudoUser' => (
36             isa => "Str",
37             required => 1,
38             );
39              
40             has ['+sudoHost', '+sudoRunAsUser', '+sudoCommand'] => (
41             default => sub { ["ALL"] },
42             );
43              
44             __PACKAGE__->meta->make_immutable;
45             no Moose;
46              
47             1;
48              
49             =pod
50              
51             =head1 NAME
52              
53             App::LDAP::LDIF::Sudoer - the representation of sudoers in LDAP
54              
55             =head1 SYNOPSIS
56              
57             my $sudoer = App::LDAP::LDIF::Sudoer->new(
58             base => "ou=Sudoer,dc=example,dc=com",
59             sudoUser => "administrator",
60             );
61              
62             my $entry = $sudoer->entry;
63             # to be Net::LDAP::Entry;
64              
65             my $sudoer = App::LDAP::LDIF::Sudoer->new($entry);
66             # new from a Net::LDAP::Entry;
67              
68             =cut
69