[rt-users] Create a new Ticket via RT Web Interface - behavior of specifying Cc's

Pei Ku pku at autotradecenter.com
Thu Jan 13 16:49:18 EST 2005


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



> -----Original Message-----
> From: Andy Harrison [mailto:aharrison at gmail.com]
> Sent: Thursday, January 13, 2005 12:21 PM
> To: Pei Ku
> Cc: rt-users at lists.bestpractical.com
> Subject: Re: [rt-users] Create a new Ticket via RT Web Interface -
> behavior of specifying Cc's
> 
> 
> > 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



More information about the rt-users mailing list