From 676210de289bcf7e5ead614066122bbefe1e0e87 Mon Sep 17 00:00:00 2001 From: Craig Kaiser Date: Wed, 4 Dec 2024 11:05:50 -0500 Subject: [PATCH] Add menu page options for global rights changes history --- lib/RT/Interface/Web/MenuBuilder.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm index f1ce9c17ac1..aba50204c8a 100644 --- a/lib/RT/Interface/Web/MenuBuilder.pm +++ b/lib/RT/Interface/Web/MenuBuilder.pm @@ -1699,6 +1699,27 @@ sub _BuildAdminMenu { $page->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" ); } } + + # Define a mapping for Rights and History paths + my %rights_pages = ( + 'Groups' => 'GroupRights.html', + 'Users' => 'UserRights.html', + ); + + # Match request paths for Rights and History pages + if ( $request_path =~ m{^/Admin/Global/(GroupRights|UserRights)\.html$} ) { + my $type = $1 eq 'GroupRights' ? 'Groups' : 'Users'; + $page->child( rights => title => loc('Rights'), path => "/Admin/Global/$1.html" ); + $page->child( history => title => loc('History'), path => "/Admin/Global/RightsHistory.html?Type=$type" ); + } + elsif ( $request_path =~ m{^/Admin/Global/RightsHistory\.html} ) { + # Extract type from request arguments + if ( my $type = $HTML::Mason::Commands::DECODED_ARGS->{'Type'} ) { + my $rights_page = $rights_pages{$type} || 'UserRights.html'; # Default to UserRights + $page->child( rights => title => loc('Rights'), path => "/Admin/Global/$rights_page" ); + $page->child( history => title => loc('History'), path => "/Admin/Global/RightsHistory.html?Type=$type" ); + } + } } sub BuildSelfServiceNav {