[rt-users] top 10 view pruned to < 10 by permissions

Schultz, Eric ESchultz at corp.untd.com
Fri Apr 7 11:58:28 EDT 2006


> -----Original Message-----
> From: rt-users-bounces at lists.bestpractical.com 
> [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf 
> Of Vivek Khera
> Sent: Thursday, April 06, 2006 6:38 PM
> To: RT-Users list
> Subject: [rt-users] top 10 view pruned to < 10 by permissions
> 
> I just set up some groups to split off queues from people who don't  
> need to see them.  However, now the top 10 tickets view shows < 10  
> tickets to some people because they don't have permissions to see  
> them.  This looks really funny when they only see 3 tickets when  
> there are enough for them to see 10 from queues to which they 
> do have  
> permission.
> 
> Is there some way to make that top 10 view really be the 10 that the  
> user is allowed to see rather than the subset of the top 10 overall?

Which section are you talking about?  If this is the "10 newest unowned
tickets", what I did was made sure that I only showed tickets in queues
that that could person could own tickets in.  Here's the code I have in
my <%init> section:

<%init>
my $rows = $RT::MyRequestsLength;

# This next section of code will limit unowned tickets to only be
# those that are in a queue that a user can own tickets in.
my $q = new RT::Queues($session{'CurrentUser'});
$q->UnLimit;
my @queues;

while (my $queue = $q->Next) {
    if ($queue->CurrentUserHasRight( 'OwnTicket' )) {
        push( @queues, "Queue = \'" . $queue->Name . "\'" );
    }
}

my $Query = "";

if (@queues) {
    $Query = "Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')
AND ( " . join( " OR ", @queues ) . " )";
}

my $QueryString = '?' . $m->comp('/Elements/QueryString',
            Query => $Query,
            Order => 'DESC',
            OrderBy => 'Priority') if ($Query);
</%init>


Hope that solves your problem!

Eric Schultz
United Online



More information about the rt-users mailing list