diff options
author | mark <mark> | 2011-01-01 00:47:17 +0000 |
---|---|---|
committer | mark <mark> | 2011-01-01 00:47:17 +0000 |
commit | edd081af5ca8e5fe87a9aaa8d364a70cc4163e74 (patch) | |
tree | ee52fdd0d514aeb178be91b1da1f14d79e82edbd /rt/lib | |
parent | 903bebf00a555e3b285df70d031f158b5f817a16 (diff) |
limit ticket creation queue dropdowns based on ACL, RT#7778
Diffstat (limited to 'rt/lib')
-rw-r--r-- | rt/lib/RT/Interface/Web.pm | 2 | ||||
-rw-r--r-- | rt/lib/RT/Principal_Overlay.pm | 4 | ||||
-rw-r--r-- | rt/lib/RT/Queue_Overlay.pm | 4 | ||||
-rw-r--r-- | rt/lib/RT/System.pm | 22 | ||||
-rw-r--r-- | rt/lib/RT/Test.pm | 3 |
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); } |