Commit 97a2444a authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Merge branch '3.0/cache-queues-hasright' into 3.0-trunk

parents 33e29060 1f5fb2a9
......@@ -11,3 +11,4 @@ MYMETA.*
/etc/upgrade/2.5.1/update_saved_searches.pl
/lib/RT/IR/Test.pm
.prove
RT-IR-*.tar.gz*
.*\.tar\.gz$
.*.asc$
^releng\.cnf$
^blib/
^pm_to_blib
......
......@@ -32,4 +32,4 @@ requires:
perl: 5.8.3
resources:
license: http://opensource.org/licenses/gpl-license.php
version: 3.0.0
version: 3.0.1rc1
......@@ -242,7 +242,7 @@
% $include_signature = 0;
% }
% if ( RT->Config->Get('ArticleOnTicketCreate')) {
<& /Articles/Elements/BeforeMessageBox, %ARGS &>
<& /Articles/Elements/BeforeMessageBox, %ARGS, QueueObj => $QueueObj &>
% }
% $m->callback( %ARGS, CallbackPage => '/Ticket/Create.html', CallbackName => 'BeforeMessageBox' );
% if ( $ARGS{Content} ) {
......
......@@ -52,7 +52,7 @@ use warnings;
package RT::IR;
our $VERSION = '3.0.0';
our $VERSION = '3.0.1rc1';
use Scalar::Util qw(blessed);
......@@ -621,6 +621,7 @@ if ( RT::IR->HasConstituency ) {
wrap 'RT::Interface::Web::Handler::CleanupRequest', pre => sub {
%RT::IR::ConstituencyCache = ();
%RT::IR::HasNoQueueCache = ();
RT::IR::_FlushQueueHasRightCache();
};
require RT::Record;
......@@ -699,6 +700,7 @@ if ( RT::IR->HasConstituency ) {
return;
};
my $queue_cache = {};
wrap 'RT::Queue::HasRight', pre => sub {
return unless $_[0]->id;
return if $_[0]->{'disable_constituency_right_check'};
......@@ -710,16 +712,26 @@ if ( RT::IR->HasConstituency ) {
my %args = (@_[1..(@_-2)]);
$args{'Principal'} ||= $_[0]->CurrentUser;
my $queues = RT::Queues->new( RT->SystemUser );
$queues->Limit( FIELD => 'Name', OPERATOR => 'STARTSWITH', VALUE => "$name - " );
my $equiv_objects;
if ( $queue_cache->{$name} ) {
$equiv_objects = $queue_cache->{$name};
} else {
my $queues = RT::Queues->new( RT->SystemUser );
$queues->Limit( FIELD => 'Name', OPERATOR => 'STARTSWITH', VALUE => "$name - " );
$equiv_objects = $queues->ItemsArrayRef;
$queue_cache->{$name} = $equiv_objects;
}
my $has_right = $args{'Principal'}->HasRight(
%args,
Object => $_[0],
EquivObjects => $queues->ItemsArrayRef,
EquivObjects => $equiv_objects,
);
$_[-1] = $has_right;
return;
};
sub _FlushQueueHasRightCache { undef $queue_cache };
require RT::Queue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment