Skip to content

Commit

Permalink
Add menu page options for global rights changes history
Browse files Browse the repository at this point in the history
  • Loading branch information
craigkai committed Dec 4, 2024
1 parent 9ae8c79 commit e0135a9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/RT/Interface/Web/MenuBuilder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e0135a9

Please sign in to comment.