aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Commands/user_search.pm
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@fripost.org>2012-06-03 22:20:58 +0200
committerGuilhem Moulin <guilhem.moulin@fripost.org>2012-06-03 22:20:58 +0200
commita3684346f4d60715512c7ca30ba9fc7bb270c38e (patch)
treeb6c4d3a5223faf5801f5e5e7860110fca5efa521 /lib/Fripost/Commands/user_search.pm
parent0461d89edb3f8e272697726208ab7747c30a81df (diff)
Merge everything into a single executable.
Diffstat (limited to 'lib/Fripost/Commands/user_search.pm')
-rw-r--r--lib/Fripost/Commands/user_search.pm58
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/Fripost/Commands/user_search.pm b/lib/Fripost/Commands/user_search.pm
new file mode 100644
index 0000000..30ffd4d
--- /dev/null
+++ b/lib/Fripost/Commands/user_search.pm
@@ -0,0 +1,58 @@
+package Fripost::Commands::user_search;
+
+use 5.010_000;
+use strict;
+use warnings;
+use utf8;
+
+=head1 NAME
+
+user_search.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<< <guilhem at fripost.org> >>
+
+=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 user_search.pm
+
+__END__