[freeside-commits] freeside/rt/lib/RT Principal_Overlay.pm, 1.1.1.12, 1.1.1.12.4.1 Queue_Overlay.pm, 1.1.1.12, 1.1.1.12.4.1 System.pm, 1.1.1.8, 1.1.1.8.4.1 Test.pm, 1.1.1.2, 1.1.1.2.4.1
Mark Wells
mark at wavetail.420.am
Fri Dec 31 16:47:19 PST 2010
Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv23404/rt/lib/RT
Modified Files:
Tag: FREESIDE_2_1_BRANCH
Principal_Overlay.pm Queue_Overlay.pm System.pm Test.pm
Log Message:
limit ticket creation queue dropdowns based on ACL, RT#7778
Index: Test.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Test.pm,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.4.1
diff -u -w -d -r1.1.1.2 -r1.1.1.2.4.1
--- Test.pm 18 May 2010 18:40:44 -0000 1.1.1.2
+++ Test.pm 1 Jan 2011 00:47:17 -0000 1.1.1.2.4.1
@@ -1027,6 +1027,9 @@
$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);
}
Index: Queue_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Queue_Overlay.pm,v
retrieving revision 1.1.1.12
retrieving revision 1.1.1.12.4.1
diff -u -w -d -r1.1.1.12 -r1.1.1.12.4.1
--- Queue_Overlay.pm 18 May 2010 18:41:18 -0000 1.1.1.12
+++ Queue_Overlay.pm 1 Jan 2011 00:47:17 -0000 1.1.1.12.4.1
@@ -381,6 +381,8 @@
unless $status;
}
+ RT->System->QueueCacheNeedsUpdate(1);
+
return ( $id, $self->loc("Queue created") );
}
@@ -421,6 +423,8 @@
$RT::Handle->Commit();
+ RT->System->QueueCacheNeedsUpdate(1);
+
if ( $val == 1 ) {
return (1, $self->loc("Queue disabled"));
} else {
Index: Principal_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Principal_Overlay.pm,v
retrieving revision 1.1.1.12
retrieving revision 1.1.1.12.4.1
diff -u -w -d -r1.1.1.12 -r1.1.1.12.4.1
--- Principal_Overlay.pm 18 May 2010 18:41:04 -0000 1.1.1.12
+++ Principal_Overlay.pm 1 Jan 2011 00:47:17 -0000 1.1.1.12.4.1
@@ -163,6 +163,8 @@
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 @@
PrincipalType => $type,
PrincipalId => $self->Id
);
+
+ RT->System->QueueCacheNeedsUpdate(1) if $args{'Right'} eq 'SeeQueue';
return ($status, $msg) unless $status;
return $ace->Delete;
}
Index: System.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/System.pm,v
retrieving revision 1.1.1.8
retrieving revision 1.1.1.8.4.1
diff -u -w -d -r1.1.1.8 -r1.1.1.8.4.1
--- System.pm 31 Dec 2009 13:09:53 -0000 1.1.1.8
+++ System.pm 1 Jan 2011 00:47:17 -0000 1.1.1.8.4.1
@@ -189,6 +189,28 @@
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";
More information about the freeside-commits
mailing list