aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Commands/search_domain.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Fripost/Commands/search_domain.pm')
-rw-r--r--lib/Fripost/Commands/search_domain.pm60
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/Fripost/Commands/search_domain.pm b/lib/Fripost/Commands/search_domain.pm
new file mode 100644
index 0000000..9c47d43
--- /dev/null
+++ b/lib/Fripost/Commands/search_domain.pm
@@ -0,0 +1,60 @@
+package Fripost::Commands::search_domain;
+
+use 5.010_000;
+use strict;
+use warnings;
+use utf8;
+
+=head1 NAME
+
+search_domain.pm - List matching virtual domains
+
+=cut
+
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+
+use Fripost::Schema;
+
+our $VERSION = '0.01';
+
+sub main {
+ my $ldap = shift;
+ my $conf = shift;
+
+ my %domain;
+ $domain{domain} = $_[0] if defined $_[0];
+ $domain{owner} = $_[1] if defined $_[1];
+
+ foreach my $domain ($ldap->domain->search( \%domain )->entries) {
+ say '' . ($domain->{isActive} ? 'ACTIVE' : 'INACTIVE')
+ . ' domain ' . $domain->{domain}
+ . ' is owned by '
+ . (defined $domain->{owner} ? join ', ', @{$domain->{owner}}
+ : '(none)');
+ }
+}
+
+
+=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 search_domain.pm
+
+__END__