[freeside-commits] freeside/rt/lib/RT Ticket_Overlay.pm,1.4,1.5

Ivan,,, ivan at wavetail.420.am
Fri Apr 18 14:19:31 PDT 2008


Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv27991

Modified Files:
	Ticket_Overlay.pm 
Log Message:
hopefully, finally fix ticket auto-association not getting along with RT ACLs

Index: Ticket_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Ticket_Overlay.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Ticket_Overlay.pm	10 Apr 2008 22:00:33 -0000	1.4
+++ Ticket_Overlay.pm	18 Apr 2008 21:19:28 -0000	1.5
@@ -724,7 +724,7 @@
       #first find any requestors with emails but *without* customer targets
       my @NoCust_Requestors =
         grep { $_->EmailAddress && ! $_->Customers->Count }
-             @{ $self->Requestors->UserMembersObj->ItemsArrayRef };
+             @{ $self->_Requestors->UserMembersObj->ItemsArrayRef };
 
       for my $Requestor (@NoCust_Requestors) {
 
@@ -752,7 +752,7 @@
   
       my @Requestors =
         grep { $_->Customers->Count }
-             @{ $self->Requestors->UserMembersObj->ItemsArrayRef };
+             @{ $self->_Requestors->UserMembersObj->ItemsArrayRef };
   
       foreach my $Requestor ( @Requestors ) {
         foreach my $cust_link ( @{ $Requestor->Customers->ItemsArrayRef } ) {
@@ -1811,6 +1811,25 @@
 
 # }}}
 
+# {{{ sub _Requestors
+
+=head2 _Requestors
+
+Private non-ACLed variant of Reqeustors so that we can look them up for the
+purposes of customer auto-association during create.
+
+=cut
+
+sub _Requestors {
+    my $self = shift:
+
+    my $group = RT::Group->new($RT::SystemUser);
+    $group->LoadTicketRoleGroup(Type => 'Requestor', Ticket => $self->Id);
+    return ($group);
+}
+
+% }}}
+
 # {{{ sub Cc
 
 =head2 Cc
@@ -2535,7 +2554,13 @@
 
     unless ( $self->{"$field$type"} ) {
         $self->{"$field$type"} = new RT::Links( $self->CurrentUser );
-        if ( $self->CurrentUserHasRight('ShowTicket') ) {
+
+        #not sure what this ACL was supposed to do... but returning the
+        # bare (unlimited) RT::Links certainly seems wrong, it causes the
+        # $Ticket->Customers method during creation to return results for every
+        # ticket...
+        #if ( $self->CurrentUserHasRight('ShowTicket') ) {
+
             # Maybe this ticket is a merged ticket
             my $Tickets = new RT::Tickets( $self->CurrentUser );
             # at least to myself
@@ -2552,7 +2577,7 @@
             $self->{"$field$type"}->Limit( FIELD => 'Type',
                                            VALUE => $type )
               if ($type);
-        }
+        #}
     }
     return ( $self->{"$field$type"} );
 }



More information about the freeside-commits mailing list