[rt-users] Should Ticket::IsWatcher() call IsMemberRecursively() instead of IsMember() ?

Gerard FENELON gerard at eve-team.com
Fri Aug 6 09:14:15 EDT 2010


Hi

I am using the code provided by 
http://wiki.bestpractical.com/view/AddWatchersOnCorrespond
but I seem to have a problem due to the fact that I have Groups as 
Watchers on some of my tickets.

The scenario is
UserA belongs to GroupB
GroupB is AdminCc of the ticket
In that case, if someone sends an email to RT with UserA in Cc
the scrip does not see that UserA is AdminCc of the ticket.

Looking at the code of the scrip, I suspect that it comes from the lines :

   if (not ($Queue->IsWatcher(Type =>  'Cc', PrincipalId =>  $Principal) or
            $Queue->IsWatcher(Type =>  'AdminCc', PrincipalId =>  $Principal) or
            $Ticket->IsWatcher(Type =>  'Cc', PrincipalId =>  $Principal) or
            $Ticket->IsWatcher(Type =>  'AdminCc', PrincipalId =>  $Principal) or
            $Ticket->IsWatcher(Type =>  'Requestor', PrincipalId =>  $Principal)
           )) {
     # If the user is a member of the experts group, then add them as an AdminCc, otherwise as a normal Cc:


Then if I look in lib/RT/Ticket_Overlay.pm for the definition of 
IsWatcher, I see

     return $group->HasMember( $args{'PrincipalId'} );

Should not this line be replaced by

     return $group->HasMemberRecursively( $args{'PrincipalId'} );

Are they any drawbacks in doing so ?
Would it be better to create another function IsWatcherRecursively() ?

Thanks
Gerard



More information about the rt-users mailing list