RichardF: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
 
(No difference)

Latest revision as of 15:36, 6 April 2016

We are trialling RT (currently v3.6.4) to help us manage job requests from our clients.

To make user management easier, all users are privileged (so the all show up in the user list without needing to search on %), but our logins related to our clients are "semi-privileged" in that they are being limited to the SelfService interface only via the autohandler modification mentioned on the AutoRedirectToSelfService page (ie clients don't have the OwnTicket right, but all staff do).

Each client has its own group and queue, and all logins for the client are only given access the their queue, with CreateTicket, SeeQueue, ShowTicket & ReplyTicket privileges only. The client users also are given ModifySelf privilege so they can change their password.

We have also modified the SelfService interface so that the Open Tickets and Closed Tickets pages show both the tickets that the particular user has created, plus a list of all of the tickets created by all logins for that client (ie all tickets in all the queues that particular user has ShowTicket rights on, which is only the queue for all tickets related to that client).

To achieve this, the following modification (admittedly not very elegant!) was made to html/SelfService/Elements/MyRequests (we also added a few formatting and sorting changes to the default template too):

<&| /Widgets/TitleBox, title =>  $title &>
 <& /Elements/TicketList, Title   => $title,
                         Format  => @Format,
                         Query   => $Query,
                         Order   => $Order,
                          OrderBy => $OrderBy,
                         BaseURL => $BaseURL,
                         Page    => $Page &>
 </&>
 <&| /Widgets/TitleBox, title =>  $gtitle &>
 <& /Elements/TicketList, Title   => $gtitle,
                         Format  => @GFormat,
                         Query   => $GQuery,
                         Order   => $Order,
                         OrderBy => $OrderBy,
                         BaseURL => $BaseURL,
                         Page    => $Page &>
 </&>
 <%INIT>
 my $id = $session{'CurrentUser'}->id;
 
 # Determine queues this user can see
 my $Queues = RT::Queues->new($session{'CurrentUser'});
 $Queues->UnLimit();
 
 my $Query = "( "
    . join( ' OR ', map "$_.id = $id", @roles )
    . ")";
 my $GQuery = "( ";
 my $queueCount = 0;
 while (my $queue = $Queues->Next) {
   if ($queue->CurrentUserHasRight('ShowTicket'))
   {
      if ($queueCount > 0)
      {
        $GQuery .= ' OR ';
      }
      $queueCount++;
      $GQuery .= "Queue = '" . $queue -> Name . "'";
   }
 }
 # handle users with no queues
 if ($queueCount == 0)
 {
   $GQuery .= "1=1";
 }
 $GQuery .= ")";
 
 if ( @status ) {
   my $sQuery = " AND ( "
        . join( ' OR ', map "Status = '$_'", @status )
        . " )";
   $Query .= $sQuery;
   $GQuery .= $sQuery;
 }
 
 #my $Order = "ASC";
 #my $OrderBy = "Created";
 
 # Order by priority - highest to lowest
 my $Order = "DESC";
 my $OrderBy = "Priority";
 
 my @Format = qq{
   '<B><A HREF="$RT::WebPath/SelfService/Display.html?id=__id__">__id__</a></B>/TITLE:#/ALIGN:center',
   '<B><A HREF="$RT::WebPath/SelfService/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
   '__Status__/ALIGN:center',
   '__Priority__/ALIGN:center'
 };
 
 my @GFormat = qq{
    '<B><A HREF="$RT::WebPath/SelfService/Display.html?id=__id__">__id__</a></B>/TITLE:#',
    '<B><A HREF="$RT::WebPath/SelfService/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
   '__CreatedBy__/ALIGN:center',
   '__Status__/ALIGN:center',
   '__Priority__/ALIGN:center',
   '__QueueName__/ALIGN:center'
 };
 </%INIT>
 <%ARGS>
 $friendly_status => loc('open')
 $title => loc("My [_1] tickets", $friendly_status)
 $gtitle => "All " . $friendly_status . " tickets for my company"
 @roles => ('Watcher')
 @status => ('open', 'new', 'stalled')
 $BaseURL => undef
 $Page => 1
 </%ARGS>