[Rt-commit] rt branch 4.4/check-all-role-emails-on-ticket-create created. rt-4.4.5-24-gfa33e39e3d

BPS Git Server git at git.bestpractical.com
Fri Feb 11 19:51:22 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 4.4/check-all-role-emails-on-ticket-create has been created
        at  fa33e39e3d3b2627adb4f54f09f71168c81bae92 (commit)

- Log -----------------------------------------------------------------
commit fa33e39e3d3b2627adb4f54f09f71168c81bae92
Author: Brian Conry <bconry at bestpractical.com>
Date:   Fri Feb 11 13:48:25 2022 -0600

    Check email of custom role members on ticket create
    
    Previously on ticket create the email adddresses of custom role members
    were not checked to verify that they weren't known to be used by RT to
    receive email.  This would allow for the creation of mail loops from RT
    to itself.
    
    Now custom roles are checked and processed the same as the built-in
    roles Requestor, Cc, and AdminCc.

diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index 39eff18f58..df81d4fc35 100644
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -502,8 +502,18 @@ if ( !exists $ARGS{'AddMoreAttach'} && ($ARGS{'id'}||'') eq 'new' ) {
 
 # check email addresses for RT's
 {
-    foreach my $field ( qw(Requestors Cc AdminCc) ) {
-        my $value = $ARGS{ $field };
+    my $custom_roles = $QueueObj->CustomRoles;
+    my @static_roles = qw(Requestors Cc AdminCc);
+    while (my $field = shift @static_roles || $custom_roles->Next) {
+        my $rolename = $field;
+        my $argsname = $field;
+
+        if (ref $field) {
+            $rolename = $field->Name;
+            $argsname = $field->GroupType;
+        }
+
+        my $value = $ARGS{ $argsname };
         next unless defined $value && length $value;
 
         my @emails;
@@ -512,7 +522,7 @@ if ( !exists $ARGS{'AddMoreAttach'} && ($ARGS{'id'}||'') eq 'new' ) {
             if ( $entry->{type} eq 'mailbox' ) {
                 my $email = $entry->{value};
                 if ( RT::EmailParser->IsRTAddress($email->address) ) {
-                    push @results, loc("[_1] is an address RT receives mail at. Adding it as a '[_2]' would create a mail loop", $email->format, loc($field =~ /^(.*?)s?$/) );
+                    push @results, loc("[_1] is an address RT receives mail at. Adding it as a '[_2]' would create a mail loop", $email->format, loc($rolename =~ /^(.*?)s?$/) );
                     $checks_failure ||= 1;
                 }
                 else {
@@ -523,7 +533,7 @@ if ( !exists $ARGS{'AddMoreAttach'} && ($ARGS{'id'}||'') eq 'new' ) {
                 push @emails, $entry->{value};
             }
         }
-        $ARGS{ $field } = join ', ', grep defined, @emails;
+        $ARGS{ $argsname } = join ', ', grep defined, @emails;
     }
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list