RT Hack: Propogate permission to dependent tickets

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.

I had some old code that made it possible to view a ticket
if the AdminCc had permission to see a ticket that was depended
on by a ticket they could see.

Today I had a inspiration for doing this more cleanly. Here
is the simpler and much faster code:


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} = 'ShowTicket') {
    my $deps = RT::Tickets->new($self->CurrentUser);

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

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


End code

This could be extended to recursively add all tickets in a
dependency chain.

I’ll add this to the wiki.


Correction, the proper file would be Ticket_Local.pm. I knew that! :slight_smile: