summaryrefslogtreecommitdiff
path: root/rt/lib
diff options
context:
space:
mode:
Diffstat (limited to 'rt/lib')
-rw-r--r--rt/lib/RT/Interface/Web.pm2
-rw-r--r--rt/lib/RT/Principal_Overlay.pm4
-rw-r--r--rt/lib/RT/Queue_Overlay.pm4
-rw-r--r--rt/lib/RT/System.pm22
-rw-r--r--rt/lib/RT/Test.pm3
5 files changed, 33 insertions, 2 deletions
diff --git a/rt/lib/RT/Interface/Web.pm b/rt/lib/RT/Interface/Web.pm
index edb719df5..106209d64 100644
--- a/rt/lib/RT/Interface/Web.pm
+++ b/rt/lib/RT/Interface/Web.pm
@@ -1345,8 +1345,6 @@ sub ParseDateToISO {
sub ProcessACLChanges {
my $ARGSref = shift;
- #XXX: why don't we get ARGSref like in other Process* subs?
-
my @results;
foreach my $arg ( keys %$ARGSref ) {
diff --git a/rt/lib/RT/Principal_Overlay.pm b/rt/lib/RT/Principal_Overlay.pm
index 75f89ca68..42474f863 100644
--- a/rt/lib/RT/Principal_Overlay.pm
+++ b/rt/lib/RT/Principal_Overlay.pm
@@ -163,6 +163,8 @@ sub GrantRight {
my $type = $self->_GetPrincipalTypeForACL();
+ RT->System->QueueCacheNeedsUpdate(1) if $args{'Right'} eq 'SeeQueue';
+
# If it's a user, we really want to grant the right to their
# user equivalence group
return $ace->Create(
@@ -210,6 +212,8 @@ sub RevokeRight {
PrincipalType => $type,
PrincipalId => $self->Id
);
+
+ RT->System->QueueCacheNeedsUpdate(1) if $args{'Right'} eq 'SeeQueue';
return ($status, $msg) unless $status;
return $ace->Delete;
}
diff --git a/rt/lib/RT/Queue_Overlay.pm b/rt/lib/RT/Queue_Overlay.pm
index 98bdec579..dcca84eb4 100644
--- a/rt/lib/RT/Queue_Overlay.pm
+++ b/rt/lib/RT/Queue_Overlay.pm
@@ -381,6 +381,8 @@ sub Create {
unless $status;
}
+ RT->System->QueueCacheNeedsUpdate(1);
+
return ( $id, $self->loc("Queue created") );
}
@@ -421,6 +423,8 @@ sub SetDisabled {
$RT::Handle->Commit();
+ RT->System->QueueCacheNeedsUpdate(1);
+
if ( $val == 1 ) {
return (1, $self->loc("Queue disabled"));
} else {
diff --git a/rt/lib/RT/System.pm b/rt/lib/RT/System.pm
index 2a23e32e4..e61e35f27 100644
--- a/rt/lib/RT/System.pm
+++ b/rt/lib/RT/System.pm
@@ -189,6 +189,28 @@ sub SubjectTag {
return grep !$seen{lc $_}++, values %$map;
}
+=head2 QueueCacheNeedsUpdate ( 1 )
+
+Attribute to decide when SelectQueue needs to flush the list of queues
+ and retrieve new ones. Set when queues are created, enabled/disabled
+ and on certain acl changes. Should also better understand group management.
+
+If passed a true value, will update the attribute to be the current time.
+
+=cut
+
+sub QueueCacheNeedsUpdate {
+ my $self = shift;
+ my $update = shift;
+
+ if ($update) {
+ return $self->SetAttribute(Name => 'QueueCacheNeedsUpdate', Content => time);
+ } else {
+ my $cache = $self->FirstAttribute('QueueCacheNeedsUpdate');
+ return (defined $cache ? $cache->Content : 0 );
+ }
+}
+
eval "require RT::System_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/System_Vendor.pm});
eval "require RT::System_Local";
diff --git a/rt/lib/RT/Test.pm b/rt/lib/RT/Test.pm
index b8d1683d0..64b736fad 100644
--- a/rt/lib/RT/Test.pm
+++ b/rt/lib/RT/Test.pm
@@ -1027,6 +1027,9 @@ sub start_standalone_server {
$RT::Handle->dbh( undef );
RT->ConnectToDatabase;
+ # the attribute cache holds on to a stale dbh
+ delete $RT::System->{attributes};
+
return ($ret, RT::Test::Web->new);
}