[rt-users] View dashboard of another user who's searches depend on __CurrentUser__

Woody - Wild Thing Safaris woody at wildthingsafaris.com
Thu Jan 21 07:47:31 EST 2016

Hi all,

I have a dashboard, in which there are searches that depend on 
__CurrentUser__, so each user that accesses the dashboard can only see 
tickets owned by them.

If someone is away, i would like someone else to be able to see the 
dashboard of the absent person. I don't want to give them the absent 
user's login, nor do i want to create searches for each user that are 
hardwired to their username.

Something like www.myrt.com/dashboards/12345/Dashname/Username would do 
the job whereby __CurrentUser__ is replaced by "Username" and not the 
person who's actually logged in.

I can see in lib/RT/Tickets.pm in sub _parser the line

         # replace __CurrentUser__ with id
         $value = $self->CurrentUser->id if $value eq '__CurrentUser__';

and in lib/RT/Search/Simple.pm

sub HandleOwner     {
     if (!$_[2] and $_[1] eq "me") {
         return owner => "Owner.id = '__CurrentUser__'";
     elsif (!$_[2] and $_[1] =~ /\w+@\w+/) {
         return owner => "Owner.EmailAddress = '$_[1]'";
     } else {
         return owner => "Owner = '$_[1]'";

So i think that a hack is needed somewhere there, and when the url is 
parsed the extra username field assigned to a variable that can be used 
in those subs. I can't find however where sub HandleOwner is called from 
since that's the only time it appears in the code!

Does this sound like a sensible way of going about it, or can anyone 
think of a better solution, or know of an existing one?

thanks in advance




Richard Wood (Woody)
Managing Director
Wild Thing Safaris Ltd.

UK: 2B Habbo St, Greenwich, London
Dar es Salaam: 5 Ethan St, Mbezi beach
Arusha: 3 Ebeneezer Rd, Njiro
PO BOX 34514 DSM
Office: +255 (0) 222 617 166
Office Mobile: +255 (0) 773 503 502
Direct: +255 742 373 327
Skype: woody1tz

More information about the rt-users mailing list