From ccc5ce7bf9abe341119acb0aa4a8a138add41dc7 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 5 Jun 2012 09:49:33 +0200 Subject: Changing the command names to something more intuitive (hopefully). --- lib/Fripost/Commands/search_user.pm | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lib/Fripost/Commands/search_user.pm (limited to 'lib/Fripost/Commands/search_user.pm') diff --git a/lib/Fripost/Commands/search_user.pm b/lib/Fripost/Commands/search_user.pm new file mode 100644 index 0000000..f476a98 --- /dev/null +++ b/lib/Fripost/Commands/search_user.pm @@ -0,0 +1,58 @@ +package Fripost::Commands::search_user; + +use 5.010_000; +use strict; +use warnings; +use utf8; + +=head1 NAME + +search_user.pm - List matching virtual users + +=cut + +use FindBin qw($Bin); +use lib "$Bin/lib"; + +use Fripost::Schema; + +our $VERSION = '0.01'; + +our @EXPORT = qw/main/; +our @ISA = qw(Exporter); + +sub main { + my $ldap = shift; + my $conf = shift; + + my %user; + $user{username} = $_[0] if defined $_[0]; + + foreach my $user ($ldap->user->search( \%user )->entries) { + say '' . ($user->{isActive} ? 'ACTIVE' : 'INACTIVE') + . ' user ' . $user->{username}; + } +} + +=head1 AUTHOR + +Guilhem Moulin C<< >> + +=head1 COPYRIGHT + +Copyright 2012 Guilhem Moulin. + +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify it +under the same terms as perl itself. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +=cut + +1; # End of search_user.pm + +__END__ -- cgit v1.2.3