[rt-users] Auto adding users to privileged groups
Kimberly McKinnis
kmckinnis at tivo.com
Fri Jun 8 18:44:07 EDT 2007
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\.com' => "cust1",
'\@.*\.?cust2\.com' => "cust2",
'\@.*\.?cust3\.com' => "cust3",
);
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
my $user = RT::User->new( $RT::SystemUser );
$user->LoadByEmail($self->TicketObj->RequestorAddresses);
die "couldn't load user" unless $user->id;
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup( $domain_map{$domainKey} );
$group->AddMember($user->id);
}
}
Whoever wrote the code snippets page on the wiki is officially my hero.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20070608/d692d8a0/attachment.htm>
More information about the rt-users
mailing list