Auto adding users to privileged groups

Interestingly, my original email hadn’t shown up on the list yet… but
I made the script work myself. I was missing a few steps.

I have an email alias pointing to the ‘accounts’ queue. I gave unpriv
users the ability the create tickets in the accounts queue. On Create, I
have two scripts. One for $self->TicketObj->SetStatus(‘resolved’); and
the other:

my $domains = {};

my %domain_map = (
‘@..?’ => “cust1”,
.?’ => “cust2”,
‘@.*.?’ => “cust3”,

foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {

my $user = RT::User->new( $RT::SystemUser );
die “couldn’t load user” unless $user->id;
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup( $domain_map{$domainKey} );

Whoever wrote the code snippets page on the wiki is officially my hero.