[rt-users] Scrips firing at will - huh?

Todd Chapman todd at chaka.net
Mon Dec 12 11:11:50 EST 2005


On Mon, Dec 12, 2005 at 04:17:40PM +0100, Leif Nixon wrote:
> Stephen Turner <sturner at MIT.EDU> writes:
> 
> > I was wondering if moving the code to the 'Custom action cleanup code'
> > section would solve the problem? You may also need to put "return 1;"
> > into the Custom action prep section.
> 
> Yes, it seems it does.
> 
> However, now I have another problem. The problem itself is mainly
> cosmetic, but I'd like to understand what's causing it.
> 
> In the action prep section I now have a check for "this ticket is
> owned by Nobody" and also a check for
> $self->TicketObj->CurrentUserHasRight('OwnTicket').
> 
> The action cleanup section now contains:
> 
>   my $ticket = $self->TicketObj;
>   my $Actor = $self->TransactionObj->CreatorObj->Id;
> 
>   if ($ticket->CurrentUserHasRight('OwnTicket')) { # Debug message
>     $RT::Logger->info("The user seems to be allowed to own tickets");
>   }
> 
>   if ($Actor != $ticket->OwnerObj->Id) {
>     $RT::Logger->info("Auto assign ticket #". $ticket->id ." to user #". $Actor );
> 
>     my ($status, $msg) = $ticket->SetOwner($Actor);
>     unless( $status ) {
>        $RT::Logger->error("AutoTake error: $msg");
>        return(undef);
>     }
>   }
> 
> Seems simple enough, but if a non-privileged user replies to an
> unowned ticket I get the following in the log:
> 
>   Dec 12 16:03:49 d116 RT: The user seems to be allowed to own tickets ((eval 449) :5)  
>   Dec 12 16:03:49 d116 RT: Auto assign ticket #5 to user #28 ((eval 449):8)  
>   Dec 12 16:03:49 d116 RT: AutoTake error: That user may not own tickets in that queue ((eval 449):12)  
> 
> Why does $ticket->CurrentUserHasRight('OwnTicket') return true for a
> non-privileged user? Should I dig up the queue and call
> CurrentUserHasRight() on that instead?
> 

Did you give non-privileged users the right to OwnTicket?



More information about the rt-users mailing list