[Rt-commit] rt branch, rt-address-regexp, updated. rt-3.8.7-148-gba10003
Ruslan Zakirov
ruz at bestpractical.com
Thu Feb 18 17:59:23 EST 2010
The branch, rt-address-regexp has been updated
via ba10003e398f6e8c5964816478a3e62e36d92dff (commit)
via c81975cff6f0dc523c5bd57f4ef592b93be18325 (commit)
from 25c972b8e107450a1ec406614ad0d8d7d8cf7161 (commit)
Summary of changes:
lib/RT/Queue_Overlay.pm | 7 +++++++
lib/RT/Ticket_Overlay.pm | 8 ++++++++
share/html/Admin/Queues/Modify.html | 7 +++++++
3 files changed, 22 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit c81975cff6f0dc523c5bd57f4ef592b93be18325
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Thu Feb 18 22:24:49 2010 +0300
don't allow to add RT addresses as watchers in API
this covers Ticket/People page as well
diff --git a/lib/RT/Queue_Overlay.pm b/lib/RT/Queue_Overlay.pm
index a839679..fc5e555 100755
--- a/lib/RT/Queue_Overlay.pm
+++ b/lib/RT/Queue_Overlay.pm
@@ -787,8 +787,15 @@ sub _AddWatcher {
my $principal = RT::Principal->new( $self->CurrentUser );
if ( $args{'PrincipalId'} ) {
$principal->Load( $args{'PrincipalId'} );
+ if ( $principal->id and $principal->IsUser and my $email = $principal->Object->EmailAddress ) {
+ return (0, $self->loc("[_1] is an address RT receives mail at. Adding it as a '[_2]' would create a mail loop", $email, $self->loc($args{'Type'})))
+ if RT::EmailParser->IsRTAddress( $email );
+ }
}
elsif ( $args{'Email'} ) {
+ if ( RT::EmailParser->IsRTAddress( $args{'Email'} ) ) {
+ return (0, $self->loc("[_1] is an address RT receives mail at. Adding it as a '[_2]' would create a mail loop", $args{'Email'}, $self->loc($args{'Type'})));
+ }
my $user = RT::User->new($self->CurrentUser);
$user->LoadByEmail( $args{'Email'} );
$user->Load( $args{'Email'} )
diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index 438dde7..c1ee2bb 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -1103,12 +1103,20 @@ sub _AddWatcher {
my $principal = RT::Principal->new($self->CurrentUser);
if ($args{'Email'}) {
+ if ( RT::EmailParser->IsRTAddress( $args{'Email'} ) ) {
+ return (0, $self->loc("[_1] is an address RT receives mail at. Adding it as a '[_2]' would create a mail loop", $args{'Email'}, $self->loc($args{'Type'})));
+ }
my $user = RT::User->new($RT::SystemUser);
my ($pid, $msg) = $user->LoadOrCreateByEmail( $args{'Email'} );
$args{'PrincipalId'} = $pid if $pid;
}
if ($args{'PrincipalId'}) {
$principal->Load($args{'PrincipalId'});
+ if ( $principal->id and $principal->IsUser and my $email = $principal->Object->EmailAddress ) {
+ return (0, $self->loc("[_1] is an address RT receives mail at. Adding it as a '[_2]' would create a mail loop", $email, $self->loc($args{'Type'})))
+ if RT::EmailParser->IsRTAddress( $email );
+
+ }
}
commit ba10003e398f6e8c5964816478a3e62e36d92dff
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Thu Feb 18 22:39:53 2010 +0300
warn admin if RTAddressRegexp is set, but queue's address doesn't match
diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index df97a68..c6ffe17 100755
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -194,6 +194,13 @@ if ( $QueueObj->Id ) {
);
push @results, @linkresults;
push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $QueueObj );
+ if ( RT->Config->Get('RTAddressRegexp') ) {
+ foreach my $address ( $QueueObj->CorrespondAddress, $QueueObj->CommentAddress ) {
+ next unless defined $address && length $address;
+ next if RT::EmailParser->IsRTAddress( $address );
+ push @results, loc("RTAddressRegexp option in the config doesn't match [_1]", $address );
+ }
+ }
}
</%INIT>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list