[rt-users] Scrip Issue: Notify other recipients if not created by queue manager

Kevin Falcone falcone at bestpractical.com
Mon Jul 18 11:11:38 EDT 2011


On Fri, Jul 15, 2011 at 05:36:30PM -0400, Matt Brennan wrote:
> Greetings,
> 
>   This one has been stumping me for a week now so I figure it's time
> to ask for help. I am trying to create two scrips, neither of which I
> can get to work. The first and more important is to notify "other
> recipients" only if the ticket was not submitted by a member of the
> queue managers group for the appropriate queue.
> 
>   I.E. A user submits a ticket in the ServerAdmin queue, the queue
> managers for that queue get notified. However, if I submit a ticket in
> that queue, the rest of the queue managers should not be notified.
> Notifying the group is not an issue, however whenever I submit a
> ticket it still causes notification. The User Defined condition I have
> is:
> 
> if ($self->TransactionObj->Type eq 'Create') {
>   my $GroupObj = RT::Group->new( $RT::SystemUser );
>   $GroupObj->LoadUserDefinedGroup( $self->TicketObj->QueueObj->Name );
>   if ($GroupObj->HasMemberRecursively( $self->CurrentUser->PrincipalObj )) {

You should $RT::Logger->error() out $self->CurrentUser information, it
isn't who you think it is.

$self->TransactionObj->CreatorObj->PrincipalObj is likely to be closer
to what you want

-kevin

>     return 0;
>   }
>   return 1;
> }
> 
> The LoadUserDefinedGroup paramater should be correct -- I have the
> group for queue managers named identical to the queue.
> 
> Thanks,
> Matt Brennan
> 
> --------
> 2011 Training: http://bestpractical.com/services/training.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110718/fae23b35/attachment.sig>


More information about the rt-users mailing list