Commit 4a90d555 authored by Mic Kaczmarczik's avatar Mic Kaczmarczik
Browse files

Update owner_domain check in Users.pm to properly allow owner name/private info updates

parent c33f7f04
......@@ -70,8 +70,30 @@ use constant _global_validations => {
# calculate updated owner list, including deletions
my @owner = map { $_->{'email'} } @{$self->get('owner')};
my $changes = $self->get_change('owner');
map { $owner[$_] = $changes->{$_}->{'email'} }
CORE::keys %{$changes || {}};
#use Data::Dumper;
#my $changedump = Dumper($changes);
#$changedump =~ s/\n//g;
#$changedump =~ s/ +/ /g;
#$log->syslog($loglevel, "conf changes = $changedump");
$log->syslog($loglevel, "BEGIN owner_domain validation");
$log->syslog($loglevel, "original owners: " . join(" ", @owner));
map {
unless (defined($changes->{$_})) {
# value undefined => owner was removed
$log->syslog($loglevel, "remove $_ \"$owner[$_]\"");
$owner[$_] = undef;
} elsif (defined($changes->{$_}->{'email'})) {
# owner address modified
my $oldowner = $owner[$_];
$owner[$_] = $changes->{$_}->{'email'};
$log->syslog($loglevel,
"update $_ \"$oldowner\" => \"$owner[$_]\"");
}
} CORE::keys %{$changes || {}};
@owner = grep defined, @owner;
# count matches and non-matches
......@@ -84,15 +106,15 @@ use constant _global_validations => {
# logging
$log->syslog($loglevel, "owner_domain: $owner_domain");
$log->syslog($loglevel, "owner_domain_min: $owner_domain_min");
$log->syslog($loglevel, "owners: " . join(",", @owner));
$log->syslog($loglevel, "updated owners: " . join(" ", @owner));
$log->syslog($loglevel, "total owners: " . ($#owner + 1));
$log->syslog($loglevel, "domainrex: $domainrex");
$log->syslog($loglevel,
"matching_owners: " . join(",", @matching_owners));
"matching_owners: " . join(" ", @matching_owners));
$log->syslog($loglevel,
"matching_owner_count: $matching_owner_count");
$log->syslog($loglevel,
"non_matching_owners: " . join(",", @non_matching_owners));
"non_matching_owners: " . join(" ", @non_matching_owners));
$log->syslog($loglevel, "non_matching_count: $non_matching_count");
# apply different rules based on min domain requirement
......@@ -116,6 +138,7 @@ use constant _global_validations => {
}
) unless ($matching_owner_count >= $owner_domain_min);
}
$log->syslog($loglevel, "END owner_domain validation");
return '';
},
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment