[rt-users] Identifying Current User

Bruce Campbell bruce_campbell at ripe.net
Fri Jul 19 16:37:12 EDT 2002


On Fri, 19 Jul 2002, Thomas Akin wrote:

> I've just installed RT and have been working on creating a
> ScipAction which will give the current user the ticket is
> they open a ticket owned by Nobody. I'm having trouble
> consistently identifying the current user in my
> ScripAction--sometimes it errors out with an unknown
> function, sometimes is assigns the correct users (rarely),
> sometimes it assigns the user RT_System to the ticket.

When working within Scrips, you are in a slightly different environment
than the rest of RT.  Possibly what you are looking for is the Creator of
the current transaction ( $self->TransactionObj->CreatorObj ) to play
with, instead of the CurrentUser.

> sub Commit {
>         my $self = shift;
>         if ($self->TicketObj->OwnerObj->Id == $RT::Nobody->Id) {
>                 return($self->TicketObj->SetOwner($self->CurrentUser->Name, 'Giv
> e'));
>         } else {

You probably want to be making sure that that person can actually own
tickets within that queue.  Heres one that I prepared earlier;

	http://www.amsterdamned.org/~bc/rt/AutoTake.pm (theres also a
	readme in that directory)

;)

-- 
                             Bruce Campbell                            RIPE
                   Systems/Network Engineer                             NCC
                 www.ripe.net - PGP562C8B1B             Operations/Security






More information about the rt-users mailing list