[Rt-commit] r7125 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Fri Mar 2 21:25:00 EST 2007


Author: ruz
Date: Fri Mar  2 21:24:59 2007
New Revision: 7125

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm

Log:
 r4657 at cubic-pc:  cubic | 2007-03-03 05:07:07 +0300
 RT::Transaction::
 * use CurrentUserCanSee instead of duplicating code multipling bugs on changes


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm	Fri Mar  2 21:24:59 2007
@@ -434,17 +434,8 @@
 
     $self->{'attachments'} = RT::Attachments->new( $self->CurrentUser );
 
-    # if it's a comment, return an empty object if they don't have the right to see it
-    if ( $self->__Value('Type') eq 'Comment' ) {
-        unless ( $self->CurrentUserHasRight('ShowTicketComments') ) {
-            return $self->{'attachments'};
-        }
-    }
-    # if they ain't got rights to see, return an empty object
-    elsif ( $self->__Value('ObjectType') eq "RT::Ticket" ) {
-        unless ( $self->CurrentUserHasRight('ShowTicket') ) {
-            return $self->{'attachments'};
-        }
+    unless ( $self->CurrentUserCanSee ) {
+        return $self->{'attachments'};
     }
 
     $self->{'attachments'}->Limit( FIELD => 'TransactionId', VALUE => $self->Id );
@@ -503,21 +494,8 @@
 sub Description {
     my $self = shift;
 
-    #Check those ACLs
-    #If it's a comment or a comment email record,
-    #  we need to be extra special careful
-
-    if ( $self->__Value('Type') =~ /^Comment/ ) {
-        unless ( $self->CurrentUserHasRight('ShowTicketComments') ) {
-            return ( $self->loc("Permission Denied") );
-        }
-    }
-
-    #if they ain't got rights to see, don't let em
-    elsif ($self->__Value('ObjectType') eq "RT::Ticket") {
-        unless ( $self->CurrentUserHasRight('ShowTicket') ) {
-            return ($self->loc("Permission Denied") );
-        }
+    unless ( $self->CurrentUserCanSee ) {
+        return ( $self->loc("Permission Denied") );
     }
 
     unless ( defined $self->Type ) {
@@ -540,19 +518,8 @@
 sub BriefDescription {
     my $self = shift;
 
-    #If it's a comment or a comment email record,
-    #  we need to be extra special careful
-    if ( $self->__Value('Type') =~ /^Comment/ ) {
-        unless ( $self->CurrentUserHasRight('ShowTicketComments') ) {
-            return ( $self->loc("Permission Denied") );
-        }
-    }
-
-    #if they ain't got rights to see, don't let em
-    elsif ( $self->__Value('ObjectType') eq "RT::Ticket" ) {
-        unless ( $self->CurrentUserHasRight('ShowTicket') ) {
-            return ( $self->loc("Permission Denied") );
-        }
+    unless ( $self->CurrentUserCanSee ) {
+        return ( $self->loc("Permission Denied") );
     }
 
     my $type = $self->Type;    #cache this, rather than calling it 30 times


More information about the Rt-commit mailing list