Skip to content

Commit 67775b9

Browse files
committed
Merge branch '6.0/update-menus'
2 parents 231b13e + a061a53 commit 67775b9

12 files changed

Lines changed: 308 additions & 219 deletions

File tree

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM bpssysadmin/rt-base-debian:RT-5.0.8-buster-20250509
1+
FROM bpssysadmin/rt-base-debian:RT-6.0.0-bullseye-20250509
22

33
LABEL maintainer="Best Practical Solutions <contact@bestpractical.com>"
44

55
# Valid values are RT branches like 5.0-trunk or version tags like rt-4.4.4
6-
ARG RT_VERSION=5.0-trunk
7-
ARG RT_DB_NAME=rt5
6+
ARG RT_VERSION=6.0-trunk
7+
ARG RT_DB_NAME=rt6
88
ARG RT_DB_TYPE=mysql
99
ARG RT_DBA_USER=root
1010
ARG RT_DBA_PASSWORD=password

etc/initialdata

Lines changed: 93 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,42 @@ push @ACL, (
637637
{ GroupId => 'DutyTeam', # - principalId
638638
GroupDomain => 'UserDefined',
639639
Queue => 0,
640-
Right => 'CreateSavedSearch',
640+
Right => 'SeeOwnSavedSearch',
641641
},
642642
{ GroupId => 'DutyTeam', # - principalId
643643
GroupDomain => 'UserDefined',
644644
Queue => 0,
645-
Right => 'EditSavedSearches',
645+
Right => 'AdminOwnSavedSearch',
646+
},
647+
{ GroupId => 'DutyTeam', # - principalId
648+
GroupDomain => 'UserDefined',
649+
Queue => 0,
650+
Right => 'SeeGroupSavedSearch',
651+
},
652+
{ GroupId => 'DutyTeam', # - principalId
653+
GroupDomain => 'UserDefined',
654+
Queue => 0,
655+
Right => 'AdminGroupSavedSearch',
656+
},
657+
{ GroupId => 'DutyTeam', # - principalId
658+
GroupDomain => 'UserDefined',
659+
Queue => 0,
660+
Right => 'SeeOwnDashboard',
661+
},
662+
{ GroupId => 'DutyTeam', # - principalId
663+
GroupDomain => 'UserDefined',
664+
Queue => 0,
665+
Right => 'AdminOwnDashboard',
666+
},
667+
{ GroupId => 'DutyTeam', # - principalId
668+
GroupDomain => 'UserDefined',
669+
Queue => 0,
670+
Right => 'SeeGroupDashboard',
671+
},
672+
{ GroupId => 'DutyTeam', # - principalId
673+
GroupDomain => 'UserDefined',
674+
Queue => 0,
675+
Right => 'AdminGroupDashboard',
646676
},
647677
{ GroupId => 'DutyTeam', # - principalId
648678
GroupDomain => 'UserDefined',
@@ -652,7 +682,7 @@ push @ACL, (
652682
{ GroupId => 'DutyTeam', # - principalId
653683
GroupDomain => 'UserDefined',
654684
Queue => 0,
655-
Right => 'ShowSavedSearches',
685+
Right => 'AdminSavedSearch',
656686
},
657687
);
658688

@@ -756,6 +786,63 @@ for my $cf (@CustomFields) {
756786
}
757787
);
758788

789+
@Dashboards = (
790+
{
791+
Name => 'RTIR Homepage',
792+
Description => 'RTIR Homepage',
793+
Content => {
794+
Elements => [
795+
{
796+
Layout => 'col-md-8,col-md-4',
797+
Elements => [
798+
[
799+
{
800+
portlet_type => 'component',
801+
component => '/RTIR/Elements/NewReports',
802+
description => '/RTIR/Elements/NewReports',
803+
path => '/RTIR/Elements/NewReports',
804+
},
805+
{
806+
portlet_type => 'component',
807+
component => '/RTIR/Elements/UserDueIncidents',
808+
description => '/RTIR/Elements/UserDueIncidents',
809+
path => '/RTIR/Elements/UserDueIncidents',
810+
},
811+
{
812+
portlet_type => 'component',
813+
component => '/RTIR/Elements/NobodyDueIncidents',
814+
description => '/RTIR/Elements/NobodyDueIncidents',
815+
path => '/RTIR/Elements/NobodyDueIncidents',
816+
},
817+
{
818+
portlet_type => 'component',
819+
component => '/RTIR/Elements/DueIncidents',
820+
description => '/RTIR/Elements/DueIncidents',
821+
path => '/RTIR/Elements/DueIncidents',
822+
},
823+
],
824+
[
825+
{
826+
portlet_type => 'component',
827+
component => '/RTIR/Elements/WorkWithConstituency',
828+
description => '/RTIR/Elements/WorkWithConstituency',
829+
path => '/RTIR/Elements/WorkWithConstituency',
830+
},
831+
{
832+
portlet_type => 'component',
833+
component => '/RTIR/Elements/QueueSummary',
834+
description => '/RTIR/Elements/QueueSummary',
835+
path => '/RTIR/Elements/QueueSummary',
836+
},
837+
]
838+
],
839+
}
840+
],
841+
},
842+
}
843+
);
844+
845+
759846
@Final = (
760847
sub {
761848
$| = 1;
@@ -815,67 +902,9 @@ for my $cf (@CustomFields) {
815902
},
816903
sub {
817904
my $dashboard = RT::Dashboard->new( RT->SystemUser );
818-
my ( $ret, $msg ) = $dashboard->Save(
819-
Name => 'RTIR Homepage',
820-
Privacy => join( '-', ref( RT->System ), RT->System->Id ),
821-
);
822-
823-
if ($ret) {
824-
my $panes = {
825-
body => [
826-
{ pane => 'body',
827-
portlet_type => 'component',
828-
component => '/RTIR/Elements/NewReports',
829-
description => '/RTIR/Elements/NewReports',
830-
path => '/RTIR/Elements/NewReports',
831-
},
832-
{ pane => 'body',
833-
portlet_type => 'component',
834-
component => '/RTIR/Elements/UserDueIncidents',
835-
description => '/RTIR/Elements/UserDueIncidents',
836-
path => '/RTIR/Elements/UserDueIncidents',
837-
},
838-
{ pane => 'body',
839-
portlet_type => 'component',
840-
component => '/RTIR/Elements/NobodyDueIncidents',
841-
description => '/RTIR/Elements/NobodyDueIncidents',
842-
path => '/RTIR/Elements/NobodyDueIncidents',
843-
},
844-
{ pane => 'body',
845-
portlet_type => 'component',
846-
component => '/RTIR/Elements/DueIncidents',
847-
description => '/RTIR/Elements/DueIncidents',
848-
path => '/RTIR/Elements/DueIncidents',
849-
},
850-
],
851-
sidebar => [
852-
{ pane => 'sidebar',
853-
portlet_type => 'component',
854-
component => '/RTIR/Elements/WorkWithConstituency',
855-
description => '/RTIR/Elements/WorkWithConstituency',
856-
path => '/RTIR/Elements/WorkWithConstituency',
857-
},
858-
{ pane => 'sidebar',
859-
portlet_type => 'component',
860-
component => '/RTIR/Elements/QueueSummary',
861-
description => '/RTIR/Elements/QueueSummary',
862-
path => '/RTIR/Elements/QueueSummary',
863-
},
864-
{ pane => 'sidebar',
865-
portlet_type => 'component',
866-
component => 'RefreshHomepage',
867-
description => 'RefreshHomepage',
868-
path => '/Elements/RefreshHomepage',
869-
},
870-
]
871-
};
872-
873-
# fill content
874-
my ( $ret, $msg ) = $dashboard->Update( Panes => $panes );
875-
if ( !$ret ) {
876-
RT->Logger->error("Couldn't update content for dashboard Homepage: $msg");
877-
}
905+
my ( $ret, $msg ) = $dashboard->LoadByCols( Name => 'RTIR Homepage' );
878906

907+
if ( $ret ) {
879908
( $ret, $msg ) = RT->System->SetAttribute(
880909
'Name' => 'RTIRDefaultDashboard',
881910
'Description' => 'RTIR Default Dashboard',
@@ -886,7 +915,7 @@ for my $cf (@CustomFields) {
886915
}
887916
}
888917
else {
889-
RT->Logger->error("Couldn't create dashboard RTIR Homepage: $msg");
918+
RT->Logger->error("Couldn't load dashboard RTIR Homepage: $msg");
890919
}
891920
},
892921
sub {
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
%# BEGIN BPS TAGGED BLOCK {{{
2+
%#
3+
%# COPYRIGHT:
4+
%#
5+
%# This software is Copyright (c) 1996-2024 Best Practical Solutions, LLC
6+
%# <sales@bestpractical.com>
7+
%#
8+
%# (Except where explicitly superseded by other copyright notices)
9+
%#
10+
%#
11+
%# LICENSE:
12+
%#
13+
%# This work is made available to you under the terms of Version 2 of
14+
%# the GNU General Public License. A copy of that license should have
15+
%# been provided with this software, but in any event can be snarfed
16+
%# from www.gnu.org.
17+
%#
18+
%# This work is distributed in the hope that it will be useful, but
19+
%# WITHOUT ANY WARRANTY; without even the implied warranty of
20+
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21+
%# General Public License for more details.
22+
%#
23+
%# You should have received a copy of the GNU General Public License
24+
%# along with this program; if not, write to the Free Software
25+
%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26+
%# 02110-1301 or visit their web page on the internet at
27+
%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
28+
%#
29+
%#
30+
%# CONTRIBUTION SUBMISSION POLICY:
31+
%#
32+
%# (The following paragraph is not intended to limit the rights granted
33+
%# to you to modify and distribute this software under the terms of
34+
%# the GNU General Public License and is only of importance to you if
35+
%# you choose to contribute your changes and enhancements to the
36+
%# community by submitting them to Best Practical Solutions, LLC.)
37+
%#
38+
%# By intentionally submitting any modifications, corrections or
39+
%# derivatives to this work, or any other work intended for use with
40+
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41+
%# you are the copyright holder for those contributions and you grant
42+
%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43+
%# royalty-free, perpetual, license to use, copy, create derivative
44+
%# works based on those contributions, and sublicense and distribute
45+
%# those contributions and any derivatives thereof.
46+
%#
47+
%# END BPS TAGGED BLOCK }}}
48+
<%INIT>
49+
50+
my $query_string = sub {
51+
my %args = @_;
52+
my $u = URI->new();
53+
$u->query_form(map { $_ => $args{$_} } sort keys %args);
54+
return $u->query || '';
55+
};
56+
57+
if ( my $admin = Menu->child('admin') ) {
58+
if ( my $global = $admin->child('global') ) {
59+
$global->child(
60+
'my-rtir' => title => 'RTIR at a glance',
61+
path => '/Admin/Global/MyRT.html?'
62+
. $query_string->(
63+
Title => loc('Customize Global RTIR at a glance'),
64+
WidgetTitle => loc('Set RTIR Homepage'),
65+
AttributeName => 'RTIRDefaultDashboard',
66+
AttributeDescription => 'RTIR Default Dashboard',
67+
),
68+
sort_order => 8.1,
69+
);
70+
}
71+
}
72+
73+
my $args = $DECODED_ARGS;
74+
75+
my @query_fields = qw(Query Format RowsPerPage Page OrderBy Order ExtraQueryParams);
76+
77+
my $search_arguments = sub {
78+
my %res = ();
79+
my $caller_args = $m->caller_args(1);
80+
if ( $caller_args->{'SearchArgs'} ) {
81+
@res{ @query_fields } = @{ $caller_args->{'SearchArgs'} }{ @query_fields };
82+
if ( $res{ExtraQueryParams} ) {
83+
$res{$_} = $caller_args->{'SearchArgs'}{$_}
84+
for ref $res{ExtraQueryParams} ? @{ $res{ExtraQueryParams} } : $res{ExtraQueryParams};
85+
}
86+
} else {
87+
@res{ @query_fields } = @{ $args }{ @query_fields };
88+
if ( $res{ExtraQueryParams} ) {
89+
$res{$_} = $args->{$_}
90+
for ref $res{ExtraQueryParams} ? @{ $res{ExtraQueryParams} } : $res{ExtraQueryParams};
91+
}
92+
}
93+
94+
delete $res{$_} foreach grep !defined $res{$_}, keys %res;
95+
return %res;
96+
};
97+
98+
my $root = Menu->child( rtir => title => loc('RTIR'), path => '/RTIR/', sort_order => '1.5' );
99+
100+
my $search = $root->child( search => title => loc('Search'), path => RT::IR->HREFTo('', IncludeWebPath => 0) );
101+
$search->child( new => title => loc('New Search'), path => '/Search/Build.html?NewQuery=1&ExtraQueryParams=RTIR&RTIR=1' );
102+
103+
$root->child(
104+
incidents => title => loc('Incidents'),
105+
path => '/Search/Results.html?ExtraQueryParams=RTIR&RTIR=1&Lifecycle='.RT::IR->lifecycle_incident,
106+
)->child(
107+
create => title => loc('Create'),
108+
path => RT::IR->HREFTo('Incident/Create.html?Lifecycle='.RT::IR->lifecycle_incident, IncludeWebPath => 0),
109+
);
110+
$root->child(
111+
reports => title => loc('Incident Reports'),
112+
path => '/Search/Results.html?ExtraQueryParams=RTIR&RTIR=1&Lifecycle='. RT::IR->lifecycle_report,
113+
)->child(
114+
create => title => loc('Create'),
115+
path => RT::IR->HREFTo('Create.html?Lifecycle='.RT::IR->lifecycle_report, IncludeWebPath => 0),
116+
);
117+
$root->child(
118+
investigations => title => loc('Investigations'),
119+
path => '/Search/Results.html?ExtraQueryParams=RTIR&RTIR=1&Lifecycle='.RT::IR->lifecycle_investigation,
120+
)->child(
121+
launch => title => loc('Launch'),
122+
path => RT::IR->HREFTo('Create.html?Lifecycle='.RT::IR->lifecycle_investigation, IncludeWebPath => 0),
123+
);
124+
unless ( RT->Config->Get('RTIR_DisableCountermeasures') ) {
125+
$root->child(
126+
countermeasures => title => loc('Countermeasures'),
127+
path => '/Search/Results.html?ExtraQueryParams=RTIR&RTIR=1&Lifecycle='.RT::IR->lifecycle_countermeasure,
128+
)->child(
129+
create => title => loc('Create'),
130+
path => RT::IR->HREFTo('Create.html?Lifecycle='.RT::IR->lifecycle_countermeasure, IncludeWebPath => 0),
131+
);
132+
}
133+
134+
my $tools = $root->child( tools => title => loc('Tools'), path => RT::IR->HREFTo('Tools/', IncludeWebPath => 0) );
135+
$tools->child( lookup => title => loc('Lookup'), path => RT::IR->HREFTo('Tools/Lookup.html', IncludeWebPath => 0));
136+
$tools->child( reporting => title => loc('Reporting'), path => RT::IR->HREFTo('Reporting/', IncludeWebPath => 0) );
137+
my $scripted_actions = $tools->child( scripted_actions => title => loc('Scripted Action') );
138+
$scripted_actions->child( email => title => loc('By Email address'), path => RT::IR->HREFTo('Tools/ScriptedAction.html', IncludeWebPath => 0) );
139+
$scripted_actions->child( ip => title => loc('By IP address'), path => RT::IR->HREFTo('Tools/ScriptedAction.html?loop=IP', IncludeWebPath => 0) );
140+
my $external_feeds = $tools->child( 'external_feeds', title => loc('External Feeds'), path => RT::IR->HREFTo('Tools/ExternalFeeds.html', IncludeWebPath => 0) );
141+
142+
my $request_path = $HTML::Mason::Commands::r->path_info;
143+
$request_path =~ s!/{2,}!/!g;
144+
145+
my $re_rtir_path = qr'^/RTIR/(?:c/[^/]*/?)?';
146+
my $re_rtir_types = '(?:'. join( '|', map "\Q$_\E", RT::IR->Types ) .')';
147+
148+
if ( $session{'CurrentUser'}->HasRight(Right => 'ModifySelf', Object => $RT::System) ) {
149+
if ( $request_path =~ m{(?:$re_rtir_path)(?:index\.html|)$} ) {
150+
PageMenu()->child( edit => raw_html => q[<a id="page-edit" class="menu-item" href="] . RT::IR->HREFTo("Prefs/Home.html") . qq["><span class="fas fa-cog" alt="].loc('Edit').q[" data-toggle="tooltip" data-placement="top" data-original-title="].loc('Edit').q["></span></a>]);
151+
}
152+
Menu->child('preferences')->child('settings')->child(
153+
rtir_home_page => title => loc('RTIR at a glance'),
154+
path => RT::IR->HREFTo('Prefs/Home.html', IncludeWebPath => 0),
155+
);
156+
}
157+
158+
</%INIT>

0 commit comments

Comments
 (0)