[Rt-commit] rt branch, 4.4/update-queue-cache-for-more-rights-changes, created. rt-4.4.3-154-gcdeba193f3
? sunnavy
sunnavy at bestpractical.com
Wed Dec 26 10:45:08 EST 2018
The branch, 4.4/update-queue-cache-for-more-rights-changes has been created
at cdeba193f3abdc8189d9d675a2513cbad57d698f (commit)
- Log -----------------------------------------------------------------
commit f9f6878eaaefab95436d1e5f74b90813c30333ab
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Dec 26 22:46:03 2018 +0800
Add "ShowTicket" and "SuperUser" right changes to update queue cache
"ShowTicket" is checked for "Queue List"; "SuperUser" rules them all.
diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index 85cd6ba8fe..a23ab837e9 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -90,7 +90,7 @@ RT::ACE->RegisterCacheHandler(sub {
);
return unless $args{Action} =~ /^(Grant|Revoke)$/i
- and $args{RightName} =~ /^(SeeQueue|CreateTicket|AdminQueue)$/;
+ and $args{RightName} =~ /^(SeeQueue|CreateTicket|AdminQueue|ShowTicket|SuperUser)$/;
RT->System->QueueCacheNeedsUpdate(1);
});
commit cdeba193f3abdc8189d9d675a2513cbad57d698f
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Dec 26 23:42:53 2018 +0800
Test SuperUser/ShowTicket in queue cache
diff --git a/t/web/queue_caching.t b/t/web/queue_caching.t
index 0f226e9003..6cc5c4fa79 100644
--- a/t/web/queue_caching.t
+++ b/t/web/queue_caching.t
@@ -167,6 +167,70 @@ diag( "Test a user starting with ShowTicket and ModifyTicket rights" );
}
}
+diag( "Test a user with SuperUser granted later" );
+{
+ my $user_e = RT::Test->load_or_create_user(
+ Name => 'user_e',
+ Password => 'password',
+ );
+ ok( $user_e && $user_e->id, 'loaded or created user' );
+
+ my $m = RT::Test::Web->new;
+ ok( $m->login( 'user_e', 'password' ), 'logged in as user E' );
+
+ check_queues( $m, [], [] );
+
+ ok(
+ RT::Test->add_rights(
+ { Principal => $user_e, Right => [qw(SuperUser)] },
+ ),
+ 'add SuperUser right'
+ );
+ for my $queue ( 1, $original_test_queue->id ) {
+ check_queues( $m );
+ $m->follow_link_ok( { text => "Ticket in queue $queue" } );
+ $m->follow_link_ok( { text => 'Basics' } );
+ check_queues( $m, undef, undef, $m->uri, 'TicketModify' );
+ }
+}
+
+diag( "Test a user with ShowTicket granted later" );
+{
+ my $user_f = RT::Test->load_or_create_user(
+ Name => 'user_f',
+ Password => 'password',
+ );
+ ok( $user_f && $user_f->id, 'loaded or created user' );
+ ok(
+ RT::Test->add_rights(
+ { Principal => $user_f, Right => [qw(SeeQueue)] },
+ ),
+ 'add global SeeQueue right'
+ );
+
+ my $m = RT::Test::Web->new;
+ ok( $m->login( 'user_f', 'password' ), 'logged in as user F' );
+
+ # Links in Queue List portlet
+ for my $queue ( 'General', $original_test_queue->Name ) {
+ ok( !$m->find_link( text => 'General' ), "no link to $queue ticket search" );
+ }
+
+ ok(
+ RT::Test->add_rights(
+ { Principal => $user_f, Right => [qw(ShowTicket)] },
+ ),
+ 'add global ShowTicket right'
+ );
+
+ $m->reload;
+
+ # Links in Queue List portlet
+ for my $queue ( 'General', $original_test_queue->Name ) {
+ ok( $m->find_link( text => $queue ), "found link to $queue ticket search" );
+ }
+}
+
sub new_queue {
my $name = shift;
my $new_queue = RT::Queue->new(RT->SystemUser);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list