File Coverage

blib/lib/Plugtools/Plugins/Samba/makeSambaAccount.pm
Criterion Covered Total %
statement 9 32 28.1
branch 0 8 0.0
condition n/a
subroutine 3 4 75.0
pod 1 1 100.0
total 13 45 28.8


line stmt bran cond sub pod time code
1             package Plugtools::Plugins::Samba::makeSambaAccount;
2              
3 1     1   24430 use warnings;
  1         3  
  1         36  
4 1     1   7 use strict;
  1         2  
  1         35  
5 1     1   641 use Plugtools::Plugins::Samba;
  1         3  
  1         206  
6              
7             =head1 NAME
8              
9             Plugtools::Plugins::Samba::makeSambaAccount - Turns a POSIX user account into a Samba account.
10              
11             =head1 VERSION
12              
13             Version 0.0.0
14              
15             =cut
16              
17             our $VERSION = '0.0.0';
18              
19              
20             =head1 SYNOPSIS
21              
22             This plugin is responsible for taking standard POSIX account and using
23             Samba::SIDhelper to turn it into a usable accounf for Samba.
24              
25             This is useful plugin for Plugtools->addUser, pluadd.
26              
27             =head1 FUNCTIONS
28              
29             =head2 plugin
30              
31             The function that will be called by Plugtools.
32              
33             use Plugtools::Plugins::Samba::makeSambaAccount;
34             %returned=Plugtools::Plugins::Samba::makeSambaAccount->plugin(\%opts, \%args);
35            
36             if($returned{error}){
37             print "Error!\n";
38             }
39              
40             =cut
41              
42             sub plugin{
43 0     0 1   my %opts;
44 0 0         if(defined($_[1])){
45 0           %opts= %{$_[1]};
  0            
46             };
47 0           my %args;
48 0 0         if(defined($_[2])){
49 0           %args= %{$_[2]};
  0            
50             };
51            
52 0           my %returned;
53 0           $returned{error}=undef;
54              
55 0           my $pts = Plugtools::Plugins::Samba->new({
56             pt=>$opts{self},
57             ldap=>$opts{ldap}
58             });
59 0 0         if ($pts->{error}) {
60 0           $returned{error}=1;
61 0           $returned{errorString}='Unable to create new Plugtools::Plugins::Samba object. $pts->{error}="'.
62             $pts->{error}.'" $pts->{errorString}="'.$pts->{errorString}.'"';
63 0           warn('Plugtools-Plugins-Samba-makeSambaAccount plugin:1: '.$returned{errorString});
64 0           return %returned;
65             }
66              
67             $pts->makeSambaAccountEntry({
68 0           entry=>$opts{entry},
69             });
70 0 0         if ($pts->{error}) {
71 0           $returned{error}=1;
72 0           $returned{errorString}='Plugtools::Plugins::Samba->makeSambaAccountEntry errored. $pts->{error}="'.
73             $pts->{error}.'" $pts->{errorString}="'.$pts->{errorString}.'"';
74 0           warn('Plugtools-Plugins-Samba-makeSambaAccount plugin:1: '.$returned{errorString});
75 0           return %returned;
76             }
77              
78 0           return %returned;
79             }
80              
81             =head1 ERROR CODES
82              
83             =head2 1
84              
85             Unable to create new Plugtools::Plugins::Samba object.
86              
87             =head2 2
88              
89             makeSambaAccountEntry errored
90              
91             =head1 AUTHOR
92              
93             Zane C. Bowers, C<< >>
94              
95             =head1 BUGS
96              
97             Please report any bugs or feature requests to C, or through
98             the web interface at L. I will be notified, and then you'll
99             automatically be notified of progress on your bug as I make changes.
100              
101              
102              
103              
104             =head1 SUPPORT
105              
106             You can find documentation for this module with the perldoc command.
107              
108             perldoc Plugtools::Plugins::Samba::SIDupdate
109              
110              
111             You can also look for information at:
112              
113             =over 4
114              
115             =item * RT: CPAN's request tracker
116              
117             L
118              
119             =item * AnnoCPAN: Annotated CPAN documentation
120              
121             L
122              
123             =item * CPAN Ratings
124              
125             L
126              
127             =item * Search CPAN
128              
129             L
130              
131             =back
132              
133              
134             =head1 ACKNOWLEDGEMENTS
135              
136              
137             =head1 COPYRIGHT & LICENSE
138              
139             Copyright 2009 Zane C. Bowers, all rights reserved.
140              
141             This program is free software; you can redistribute it and/or modify it
142             under the same terms as Perl itself.
143              
144              
145             =cut
146              
147             1; # End of Plugtools::Plugins::Samba::SIDupdate