Create a new Ticket via RT Web Interface - behavior of specifying Cc's

If a user creates a new ticket via the Web interface, following fields are avaiable:

Cc:
(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people will receive future updates.)

Admin Cc:
(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people will receive future updates.)

It appears to me that there is a side-effect to specifying “Cc” (and “Admin Cc:”): if any of the specified Cc: email addresses are not existing users in RT, then RT will new user accounts using the email addresses specified.

It’s very easy for the Ticket creator to make a typing mistake – e.g., there is one user who, instead of typing “joe@myco.com, bob@myco.com”, he typed in “joe@myco.com.bob@myco.com” in the Cc: field. When he created the ticket, RT created a user called “joe@myco.com.bob@myco.com”. Or, if the ticket creator entered a wrong email address, it gets created also.

I want to change the behavior such that RT won’t automatically create RT’s accounts for Cc’s that are not existing RT accounts. How do I do that?

thanks

Pei

I want to change the behavior such that RT won’t automatically create RT’s accounts for Cc’s that are not existing RT accounts. How do I do that?

That takes place in the LoadOrCreateByEmail sub in rt3/lib/RT/User_Overlay.pm.

There’s probably a better way, but you could probably replace the
whole unless ($self->Id) routine with something like:

     unless ($self->Id) {
         $RT::Logger->info("User creation ignored for ".$email .":

" .$message);
}

Andy Harrison

Hi Andy,

Thanks for the pointer. I think you pointed me in the right direction; however, I was not clear on one thing: when someone who is not an existing user in RT, I still want RT to create an account for that person (assuming I’ve granted the proper proper privilege to the appropriate role; e.g., CreateTicket priv to Everyone role). In other words, I still want RT to create a new RT user for the Requestor if the requestor is not a RT user yet; when a RT user specified CC’s and AdminCC’s, I don’t want RT to automatically create accounts for those email addresses that are in the CC/AdminCC lists but are not existing RT users.

Anyway, based on the inspiration you provided, I think I’ve found the right place to hack RT: lib/RT/Ticket_Overlay.pm:

We attempt to load or create each of the people who might have a role for this ticket

outside the transaction, so we don’t get into ticket creation races

foreach my $type ( "Cc", "AdminCc", "Requestor" ) {
    next unless ( defined $args{$type} );
    foreach my $watcher (
        ref( $args{$type} ) ? @{ $args{$type} } : ( $args{$type} ) )
    {
        my $user = RT::User->new($RT::SystemUser);
        $user->LoadOrCreateByEmail($watcher)
          if ( $watcher && $watcher !~ /^\d+$/ );
    }
}

I think I just need to take out “Cc” and “AdminCC” from outer-most “foreach” statement. Sounds about right?

thanks again.

Pei