aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Schema/Type/Domain.pm
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@fripost.org>2012-04-19 00:12:57 +0200
committerGuilhem Moulin <guilhem.moulin@fripost.org>2012-04-19 00:12:57 +0200
commit47135d7827c75073278089d43220df48f250b118 (patch)
treeb32e0ee5a3a70eff8836b719928a0c08bad65572 /lib/Fripost/Schema/Type/Domain.pm
parent5f15ee93f79af5af0ee064ffdb5c03f2af14ee3a (diff)
Search tools.
Diffstat (limited to 'lib/Fripost/Schema/Type/Domain.pm')
-rw-r--r--lib/Fripost/Schema/Type/Domain.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Fripost/Schema/Type/Domain.pm b/lib/Fripost/Schema/Type/Domain.pm
index f85ea87..0d2be17 100644
--- a/lib/Fripost/Schema/Type/Domain.pm
+++ b/lib/Fripost/Schema/Type/Domain.pm
@@ -14,6 +14,8 @@ our $VERSION = '0.01';
# domain is given, returns all domains.
# Filters on values of both keys `domain' and `owner' (unless they are
# undefined).
+# If `owner' is the empty string, serch for non self-managed domains
+# only.
sub search {
my $self = shift;
@@ -26,7 +28,14 @@ sub search {
my @filters = ('(ObjectClass=virtualDomain)');
push @filters, "(dc=" .$_[0]->{domain}. ")" if defined $_[0]->{domain};
- push @filters, "(owner=" .$owner. ")" if defined $_[0]->{owner};
+ if (defined $_[0]->{owner}) {
+ if ($_[0]->{owner} eq '') {
+ push @filters, "(!(owner=*))";
+ }
+ else {
+ push @filters, "(owner=" .$owner. ")";
+ }
+ }
my $filter;
if ($#filters == 0) {
$filter = $filters[0];