Helper/Model/LDAP.pm

filter: Statementstmt 41.1% 7 / 17 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 2 / 4 Podpod 100% 2 / 2 totaltotal 29.7% 11 / 37 CC 6 SCAR 33.5
CC
6
Cov
26%
mk_compclass
42.0
mk_comptest
2.0
BEGIN
1.0
CRAP 28.4
« Model/LDAP/Connection.pm ↑ Summary Model/LDAP.pm »
1 package Catalyst::Helper::Model::LDAP;
2 # ABSTRACT: Helper for LDAP models
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 0 ▶sub mk_compclass {
Subroutine mk_compclass: not called CC=6 SCAR=37.4
Pod documented
9 0 my ( $self, $helper, $host, $base, $dn, $password, $start_tls ) = @_;
10  
11 0 ▶ $helper->{host} = $host || '';
Condition0%0/2
$host || ''
l!l
00
MC/DC0%0/1
$host || ''
$host
Truth table0%0/2
A
A= $host
Aresult
11
00
12 0 ▶ $helper->{base} = $base || '';
Condition0%0/2
$base || ''
l!l
00
MC/DC0%0/1
$base || ''
$base
Truth table0%0/2
A
A= $base
Aresult
11
00
13 0 ▶ $helper->{dn} = $dn || '';
Condition0%0/2
$dn || ''
l!l
00
MC/DC0%0/1
$dn || ''
$dn
Truth table0%0/2
A
A= $dn
Aresult
11
00
14 0 ▶ $helper->{password} = $password || '';
Condition0%0/2
$password || ''
l!l
00
MC/DC0%0/1
$password || ''
$password
Truth table0%0/2
A
A= $password
Aresult
11
00
15 0 ▶ $helper->{start_tls} = $start_tls ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$start_tls ? : 0 0 0
16  
17 0 $helper->render_file( 'modelclass', $helper->{file} );
18  
19 0 return 1;
20 }
21  
22  
23 0 ▶sub mk_comptest {
Subroutine mk_comptest: not called CC=1 SCAR=6.9
Pod documented
24 0 my ( $self, $helper ) = @_;
25  
26 0 $helper->render_file( 'modeltest', $helper->{test} );
27 }
28  
29  
30 1 1;
31  
32 =pod
33  
34 =encoding UTF-8
35  
36 =head1 NAME
37  
38 Catalyst::Helper::Model::LDAP - Helper for LDAP models
39  
40 =head1 VERSION
41  
42 version 0.21
43  
44 =head1 SYNOPSIS
45  
46 script/myapp_create.pl model Person LDAP ldap.ufl.edu ou=People,dc=ufl,dc=edu dn=admin,dc=ufl,dc=edu mypass 1
47  
48 =head1 DESCRIPTION
49  
50 Helper for the L<Catalyst> LDAP model.
51  
52 =head1 USAGE
53  
54 When creating a new LDAP model class using this helper, you can
55 specify much of the configuration and have it filled automatically.
56 Using the example from the L</SYNOPSIS> section:
57  
58 =over
59  
60 =item * C<Person>
61  
62 The name of the model. This is also used to determine the filename,
63 e.g. C<lib/MyApp/Model/Person.pm>.
64  
65 =item * C<LDAP>
66  
67 The helper to use, i.e. this one.
68  
69 =item * C<ldap.ufl.edu>
70  
71 The LDAP server's fully qualified domain name (FQDN). Can also be an
72 IP address, e.g. C<127.0.0.1>.
73  
74 =item * C<ou=People,dc=ufl,dc=edu>
75  
76 The base distinguished name (DN) for searching the directory.
77  
78 =item * C<dn=admin,dc=ufl,dc=edu>
79  
80 The bind DN for connecting to the directory. This can be anyone that
81 has permission to search under the base DN, as per your LDAP server's
82 access control lists.
83  
84 =item * C<mypass>
85  
86 The password for the specified bind DN.
87  
88 =item * C<1>
89  
90 Optionally uses TLS when binding to the LDAP server, for secure
91 connections.
92  
93 =back
94  
95 =head1 METHODS
96  
97 =head2 mk_compclass
98  
99 Makes the LDAP model class.
100  
101 =head2 mk_comptest
102  
103 Makes tests for the LDAP model.
104  
105 =head1 SEE ALSO
106  
107 =over 4
108  
109 =item * L<Catalyst::Manual>
110  
111 =item * L<Catalyst::Test>
112  
113 =item * L<Catalyst::Helper>
114  
115 =back
116  
117 =head1 AUTHORS
118  
119 =over
120  
121 =item * Daniel Westermann-Clark E<lt>danieltwc@cpan.orgE<gt>
122  
123 =item * Gavin Henry E<lt>ghenry@cpan.orgE<gt> (TLS Helper option and documentation)
124  
125 =back
126  
127 =head1 LICENSE
128  
129 This library is free software; you can redistribute it and/or modify
130 it under the same terms as Perl itself.
131  
132 =head1 AUTHOR
133  
134 Gavin Henry <ghenry@surevoip.co.uk>
135  
136 =head1 COPYRIGHT AND LICENSE
137  
138 This software is copyright (c) 2017 by Gavin Henry.
139  
140 This is free software; you can redistribute it and/or modify it under
141 the same terms as the Perl 5 programming language system itself.
142  
143 =cut
144  
145 __DATA__
« Model/LDAP/Connection.pm ↑ Summary Model/LDAP.pm »