[freeside-commits] freeside/FS/FS/TicketSystem RT_Internal.pm, 1.17.4.3, 1.17.4.4
Mark Wells
mark at wavetail.420.am
Fri Dec 31 16:47:18 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/TicketSystem
In directory wavetail.420.am:/tmp/cvs-serv23404/FS/FS/TicketSystem
Modified Files:
Tag: FREESIDE_2_1_BRANCH
RT_Internal.pm
Log Message:
limit ticket creation queue dropdowns based on ACL, RT#7778
Index: RT_Internal.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/TicketSystem/RT_Internal.pm,v
retrieving revision 1.17.4.3
retrieving revision 1.17.4.4
diff -u -w -d -r1.17.4.3 -r1.17.4.4
--- RT_Internal.pm 23 Dec 2010 17:52:23 -0000 1.17.4.3
+++ RT_Internal.pm 1 Jan 2011 00:47:16 -0000 1.17.4.4
@@ -301,6 +301,35 @@
$Ticket->Correspond( Content => $param{'content'} );
}
+=item queues SESSION_HASHREF [, ACL ]
+
+Retrieve a list of queues. Pass the name of an RT access control right,
+such as 'CreateTicket', to return only queues on which the current user
+has that right. Otherwise this will return all queues with the 'SeeQueue'
+right.
+
+=cut
+
+sub queues {
+ my( $self, $session, $acl ) = @_;
+ $session = $self->session($session);
+
+ my $showall = $acl ? 0 : 1;
+ my @result = ();
+ my $q = new RT::Queues($session->{'CurrentUser'});
+ $q->UnLimit;
+ while (my $queue = $q->Next) {
+ if ($showall || $queue->CurrentUserHasRight($acl)) {
+ push @result, {
+ Id => $queue->Id,
+ Name => $queue->Name,
+ Description => $queue->Description,
+ };
+ }
+ }
+ return map { $_->{Id} => $_->{Name} } @result;
+}
+
#shameless false laziness w/RT::Interface::Web::AttemptExternalAuth
# to get logged into RT from afar
sub _web_external_auth {
More information about the freeside-commits
mailing list