[Rt-commit] r2349 - rt/branches/QUEBEC-EXPERIMENTAL/lib/RT

clkao at bestpractical.com clkao at bestpractical.com
Sun Mar 13 02:20:35 EST 2005


Author: clkao
Date: Sun Mar 13 02:20:34 2005
New Revision: 2349

Modified:
   rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Queues_Overlay.pm
Log:
Do SeeQueue permission filtering in AddRecord so both Next() and
ItemsArrayRef work.

Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Queues_Overlay.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Queues_Overlay.pm	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Queues_Overlay.pm	Sun Mar 13 02:20:34 2005
@@ -119,35 +119,22 @@
 }
 # }}}
 
-# {{{ sub Next 
+# {{{ sub AddRecord
 
-=head2 Next
+=head2 AddRecord
 
-Returns the next queue that this user can see.
+Adds a record object to this collection if this user can see.
+This is used for filtering objects for both Next and ItemsArrayRef.
 
 =cut
-  
-sub Next {
+
+sub AddRecord {
     my $self = shift;
-    
-    
-    my $Queue = $self->SUPER::Next();
-    if ((defined($Queue)) and (ref($Queue))) {
-
-	if ($Queue->CurrentUserHasRight('SeeQueue')) {
-	    return($Queue);
-	}
-	
-	#If the user doesn't have the right to show this queue
-	else {	
-	    return($self->Next());
-	}
-    }
-    #if there never was any queue
-    else {
-	return(undef);
-    }	
-    
+    my $Queue = shift;
+    return unless $Queue->CurrentUserHasRight('SeeQueue');
+
+    push @{$self->{'items'}}, $Queue;
+    $self->{'rows'}++;
 }
 # }}}
 


More information about the Rt-commit mailing list