[Rt-commit] rt branch 5.0/status-column-confirm-linked-ticket created. rt-5.0.2beta1-4-g38352b417f
BPS Git Server
git at git.bestpractical.com
Tue Aug 31 18:18:48 UTC 2021
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/status-column-confirm-linked-ticket has been created
at 38352b417fe37ad74b61c61d6f691a3da3fd11db (commit)
- Log -----------------------------------------------------------------
commit 38352b417fe37ad74b61c61d6f691a3da3fd11db
Author: craig kaiser <craig at bestpractical.com>
Date: Thu Aug 26 11:23:46 2021 -0400
Add test for extended status column rights check
diff --git a/t/web/search_results.t b/t/web/search_results.t
index 52db4aff17..2bc91beac1 100644
--- a/t/web/search_results.t
+++ b/t/web/search_results.t
@@ -23,4 +23,48 @@ $m->text_like( qr/alice.*bob.*richard/i, 'Order by Requestors ASC' );
$m->follow_link_ok( { text => 'Requestor' } );
$m->text_like( qr/richard.*bob.*alice/i, , 'Order by Requestors DESC' );
+diag "Test extended status column map when 'UseSQLForACLChecks' is false";
+{
+ RT::Test->stop_server;
+ RT->Config->Set( '$UseSQLForACLChecks' => 0 );
+ ( $baseurl, $m ) = RT::Test->started_ok;
+
+ my $queue_a = RT::Test->load_or_create_queue( Name => 'A' );
+ ok $queue_a && $queue_a->id, 'loaded or created queue_a';
+ my $qa_id = $queue_a->id;
+
+ my $user_a = RT::Test->load_or_create_user(
+ Name => 'user_a', Password => 'password', Privileged => 1
+ );
+ ok $user_a && $user_a->id, 'loaded or created user';
+ my $m_user_a = RT::Test::Web->new;
+ ok( $m_user_a->login( 'user_a', 'password' ), 'logged in as user_a' );
+
+ RT::Test->set_rights(
+ { Principal => 'Everyone', Right => [qw(SeeQueue)] },
+ { Principal => 'Requestor', Right => [qw(ShowTicket)] },
+ );
+
+ my $ticket = RT::Ticket->new( RT->SystemUser );
+ my ($id, $txn, $msg) = $ticket->Create(
+ Queue => 'A',
+ Subject => 'Parent Ticket',
+ Requestor => 'dave at localost',
+ );
+ ok $id;
+
+ # Create ticket with DependsOn relationship
+ (my $new_id, $txn, $msg) = $ticket->Create(
+ Queue => 'A',
+ Subject => 'Child Ticket',
+ Requestor => 'user_a',
+ DependsOn => $id
+ );
+
+ # Do a search with extended status column but the logged in user can only see
+ # the DependedOn ticket.
+ $m_user_a->get_ok( "/Search/Results.html?Query=id>0&Format='__id__','__ExtendedStatus__'" );
+ $m_user_a->content_lacks('Invalid column', 'No invalid column map results from extended status');
+}
+
done_testing;
commit 29d4ec2845038d1d4567b49d71eaecd6e79bf70f
Author: craig kaiser <craig at bestpractical.com>
Date: Wed Aug 25 17:02:46 2021 -0400
Extended Status column map check if tickets are actually found
When UseSQLForACLChecks=0 the 'count' of linked tickets can be found to
be 1 but due to rights checks occurring on display, the one linked ticket
may not be able to be loaded.
diff --git a/share/html/Elements/RT__Ticket/ColumnMap b/share/html/Elements/RT__Ticket/ColumnMap
index 9a98d13b1d..78391c4079 100644
--- a/share/html/Elements/RT__Ticket/ColumnMap
+++ b/share/html/Elements/RT__Ticket/ColumnMap
@@ -147,9 +147,14 @@ $COLUMN_MAP = {
my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
if ($count == 1) {
+ # Count can be 1 but when UseSQLForACLChecks is set to 0 the rights check hasn't been
+ # peformed yet, meaning the current user may not be able to see the linked ticket.
+ # Therefore we need to check if a ticket is actually found.
my $pending_ticket = $unresolved_dependencies->Next;
- my $pending_ticket_url = RT->Config->Get('WebPath') . '/Ticket/Display.html?id=' . $pending_ticket->id;
- return \'<a href="',$pending_ticket_url,\'">', loc('(pending ticket #[_1])',$pending_ticket->id), \'</a>';
+ if ($pending_ticket) {
+ my $pending_ticket_url = RT->Config->Get('WebPath') . '/Ticket/Display.html?id=' . $pending_ticket->id;
+ return \'<a href="',$pending_ticket_url,\'">', loc('(pending ticket #[_1])',$pending_ticket->id), \'</a>';
+ }
}
return \'<a href="',$SearchURL,\'">', loc('(pending [quant,_1,other ticket,other tickets])',$count), \'</a>';
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list