[Rt-commit] rt branch, 4.4/per-queue-outgoing-encryption-protocol, updated. rt-4.4.4-179-g00fac86816
Dianne Skoll
dianne at bestpractical.com
Thu Nov 19 15:13:38 EST 2020
The branch, 4.4/per-queue-outgoing-encryption-protocol has been updated
via 00fac86816c034410587e025d529630cd6a4166d (commit)
via 51b1248031d2e5424896b08c4a22db50a9e00d4c (commit)
from e28e0420ce3fadaccd036719125a10bae565f61b (commit)
Summary of changes:
lib/RT/Config.pm | 5 +++++
lib/RT/Crypt.pm | 13 +++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 51b1248031d2e5424896b08c4a22db50a9e00d4c
Author: Dianne Skoll <dianne at bestpractical.com>
Date: Thu Nov 19 14:48:13 2020 -0500
Allow RT::Crypt::UseForOutgoing to be called without a Queue arg, but issue deprecation warning.
diff --git a/lib/RT/Crypt.pm b/lib/RT/Crypt.pm
index 9de425b4e8..ae32f5bb6d 100644
--- a/lib/RT/Crypt.pm
+++ b/lib/RT/Crypt.pm
@@ -253,6 +253,12 @@ sub UseForOutgoing {
);
my $outgoing = RT->Config->Get('Crypt')->{'Outgoing'};
+ # If we don't have a queue, issue a deprecation warning
+ if ( ! defined($args{Queue}) ) {
+ RT->Deprecated(Message => 'RT::Crypt->UseForOutgoing should be passed a Queue => QUEUE argument; calling it without a Queue argument will stop working in release 5.4.0');
+ $args{Queue} = '';
+ }
+
# Old-style config: Crypt->{'Outgoing'} is a scalar to use for all queues
if ( ( ref($outgoing) || '' ) ne 'HASH' ) {
return $outgoing;
@@ -265,8 +271,10 @@ sub UseForOutgoing {
# either way, boil it down to the name.
$qname = $qname->Name if ref($qname);
- # Look for per-queue method; default to '' method in outgoing hash
- return $outgoing->{$qname} || $outgoing->{''};
+ # Look for per-queue method; default to '' method in outgoing hash;
+ # if that does not exist, default to first enabled method
+ my @enabled = RT::Crypt->EnabledProtocols;
+ return $outgoing->{$qname} || $outgoing->{''} || $enabled[0];
}
=head2 EnabledOnIncoming
@@ -319,9 +327,6 @@ sub SimpleImplementationCall {
my %args = (@_);
my $protocol = delete $args{'Protocol'};
if (!$protocol) {
- if (!$args{'Queue'}) {
- Carp::croak('If Protocol is not supplied, Queue must be supplied');
- }
$protocol = $self->UseForOutgoing(@_);
}
commit 00fac86816c034410587e025d529630cd6a4166d
Author: Dianne Skoll <dianne at bestpractical.com>
Date: Thu Nov 19 15:04:23 2020 -0500
If $Crypt->{'Outgoing'} is a hash, ensure there is always a default '' entry.
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index c3ee334d08..5adaa458cd 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -812,6 +812,11 @@ our %META;
$opt->{'Outgoing'}->{$q} = $enabled[0];
}
}
+ # If there's no entry for the default queue, set one
+ if (!$opt->{'Outgoing'}->{''} && scalar(@enabled)) {
+ $RT::Logger->warning("No default outgoing Crypt plugin set; using $enabled[0]");
+ $opt->{'Outgoing'}->{''} = $enabled[0];
+ }
} else {
if (not $enabled{$opt->{'Outgoing'}}) {
$RT::Logger->warning($opt->{'Outgoing'}.
diff --git a/lib/RT/Crypt.pm b/lib/RT/Crypt.pm
index ae32f5bb6d..740a261c82 100644
--- a/lib/RT/Crypt.pm
+++ b/lib/RT/Crypt.pm
@@ -272,9 +272,9 @@ sub UseForOutgoing {
$qname = $qname->Name if ref($qname);
# Look for per-queue method; default to '' method in outgoing hash;
- # if that does not exist, default to first enabled method
- my @enabled = RT::Crypt->EnabledProtocols;
- return $outgoing->{$qname} || $outgoing->{''} || $enabled[0];
+ # the '' entry is guaranteed to exist because it's added if necessary
+ # by the PostLoadCheck routine in RT::Config.
+ return $outgoing->{$qname} || $outgoing->{''};
}
=head2 EnabledOnIncoming
-----------------------------------------------------------------------
More information about the rt-commit
mailing list