File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -458,7 +458,7 @@ sub CheckRight {
458458 return $to eq ' deleted' ? ' DeleteTicket' : ' ModifyTicket' ;
459459}
460460
461- =head3 RightsDescription [TYPE]
461+ =head3 RightsDescription [TYPE] [LIFECYCLE]
462462
463463Returns hash with description of rights that are defined for
464464particular transitions.
@@ -468,11 +468,17 @@ particular transitions.
468468sub RightsDescription {
469469 my $self = shift ;
470470 my $type = shift ;
471+ my $lifecycle_name = shift ;
471472
472473 $self -> FillCache unless keys %LIFECYCLES_CACHE ;
473474
475+ if ( $lifecycle_name && !exists $LIFECYCLES_CACHE {$lifecycle_name } ) {
476+ RT-> Logger-> warning(" Lifecycle '$lifecycle_name ' not found in LIFECYCLES_CACHE, ignoring" );
477+ undef $lifecycle_name ;
478+ }
479+
474480 my %tmp ;
475- foreach my $lifecycle ( values %LIFECYCLES_CACHE ) {
481+ foreach my $lifecycle ( $lifecycle_name ? $LIFECYCLES_CACHE { $lifecycle_name } : values %LIFECYCLES_CACHE ) {
476482 next unless exists $lifecycle -> {' rights' };
477483 next if $type and $lifecycle -> {type } ne $type ;
478484 while ( my ($transition , $right ) = each %{ $lifecycle -> {' rights' } } ) {
Original file line number Diff line number Diff line change @@ -108,8 +108,13 @@ sub AvailableRights {
108108 my $class = ref ($self ) || $self ;
109109
110110 my %rights ;
111- $rights {$_ -> {Name }} = $_ -> {Description }
112- for values %{$RT::ACE::RIGHTS {$class } || {} };
111+ if ( blessed $self && $self -> DOES(' RT::Record::Role::Lifecycle' ) ) {
112+ %rights = RT::Lifecycle-> RightsDescription( $self -> LifecycleType, $self -> Lifecycle );
113+ }
114+
115+ $rights { $_ -> {Name } } = $_ -> {Description }
116+ for grep { $_ -> {Category } ne ' Status' } values %{ $RT::ACE::RIGHTS {$class } || {} };
117+
113118 return \%rights ;
114119}
115120
You can’t perform that action at this time.
0 commit comments