Todd, That's great and thanks for the quick reply. Excuse my ignorance, but how do I get from the Requestors RT Group to the UserObj? In this case, I'm assuming only one Requestor.
$self->TicketObj->Requestors->< missing this >$UserObj->SetPrivileged(0); return 1; Bill -----Original Message----- From: Todd Chapman [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 10:23 AM To: Bill Chever Cc: [email protected] Subject: Re: [rt-users] Set user rights with scrip? On Mon, Jun 19, 2006 at 10:01:31AM -0700, Bill Chever wrote: > RT is so cool. > > >From the wiki; > "A ScripAction can access and change the current instance of the > following > objects: > > Scrip > Ticket > Transaction > Template " > > I need to be able to affect a user's access rights with a scrip. > > Scenario: > I want to allow anyone to send requests into Support Like most you, I > get lots of messages offering me PE patches, Viagra, and partnerships > with African ex-dignitaries I need an easy way to manage and reduce > spam without missing that possible "We love your product and have $1M > to spend." > > Solution: > Have SpamAssasin insert **Possible SPAM** into the Subject line of > suspected spam (working) Have RT check the Subject line and if > 'Possible SPAM' is present, move the ticket to the 'Trash' queue while > also bypassing the AutoReply and Notify scrips (working) > > At some pre-defined schedule, have a human look at the Trash queue, > use Update multiple tickets, check all and set Status to 'deleted.' > > One very cool thing I've discovered is that if a user exists in RT, > and you uncheck "Let this user access RT", the next time that same > user attempts to send a message, RT will reject it, not create the > ticket, and send the user a terse note explaining that they do not > have create ticket rights. That would enable me to prevent any more > spam from that same user, and save my ticket numbers in the process. > > So I want to create a script that does - > > Condition: Status eq 'deleted' and Queue eq 'Trash' > Action: $RequestorObj->SetRights("Access",0) > > Or similar. Is it possible? Right now I can accomplish this > manually, but mass updates are so much better. > Yes, this can be done. Create a scrip on the Trash queue. Custom condition of $self->TransactionObj->Type eq 'Status' and $self->TicketObj->Status eq 'deleted'. $self->TicketObj->Requestors will give an RT::Group of requestors. For each requestor you can get the RT:User object at call $UserObj->SetPrivileged(0). -Todd _______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com We're hiring! Come hack Perl for Best Practical: http://bestpractical.com/about/jobs.html
