From Request Tracker Wiki
Jump to navigation Jump to search

In our organization we often have tickets that are linked with a dependency link. The role AdminCCs is given permission to see a ticket, but they could not see other tickets that their specific ticket depended on. This code makes it possible to view a ticket if the AdminCc has permission to see a ticket that is depended on by a ticket they could see.

use strict;
no warnings qw(redefine);

sub HasRight {
   my $self = shift;
   my %args = (
       Right     => undef,
       Principal => undef,

   unless ( ( defined $args{'Principal'} ) and ( ref( $args{'Principal'} ) ) )
       $RT::Logger->crit("Principal attrib undefined for Ticket::HasRight");

   my @Equiv;
   if ($args{Right} eq 'ShowTicket') {
       my $deps = RT::Tickets->new($self->CurrentUser);

       while (my $tick = $deps->Next) {
           push @Equiv, $tick;

   return (
           Object => $self,
           EquivObjects => \@Equiv,
           Right     => $args{'Right'}


This could be extended to recursively add all tickets in a dependency chain. Note that this does not give the user rights to the transaction, but that can be accomplished in a similar manner.

--Todd Chapman