[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.7-788-gb5b3577

Alex Vandiver alexmv at bestpractical.com
Thu Dec 9 14:17:00 EST 2010


The branch, 3.9-trunk has been updated
       via  b5b357766929465521281c2886456c6b1fe24824 (commit)
      from  2df546be91bf3f0863738c4b04985953e5c78944 (commit)

Summary of changes:
 lib/RT/ACL_Overlay.pm     |    3 +++
 lib/RT/Tickets_Overlay.pm |   14 +++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit b5b357766929465521281c2886456c6b1fe24824
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Dec 8 20:37:29 2010 -0500

    Avoid un-necessary ->Load calls when UseSQLForACLChecks is enabled

diff --git a/lib/RT/ACL_Overlay.pm b/lib/RT/ACL_Overlay.pm
index bfc35f6..c0b1bf4 100755
--- a/lib/RT/ACL_Overlay.pm
+++ b/lib/RT/ACL_Overlay.pm
@@ -217,6 +217,9 @@ sub Next {
     my $self = shift;
 
     my $ACE = $self->SUPER::Next();
+    # Short-circuit having to load up the ->Object
+    return $ACE
+        if $self->CurrentUser->PrincipalObj->Id == RT->SystemUser->Id;
     if ( ( defined($ACE) ) and ( ref($ACE) ) ) {
 
         if ( $self->CurrentUser->HasRight( Right  => 'ShowACL',
diff --git a/lib/RT/Tickets_Overlay.pm b/lib/RT/Tickets_Overlay.pm
index 25af445..b3fc99e 100755
--- a/lib/RT/Tickets_Overlay.pm
+++ b/lib/RT/Tickets_Overlay.pm
@@ -2908,15 +2908,15 @@ sub _RolesCanSee {
     $ACL->Limit( ALIAS => $principal_alias, FIELD => 'Disabled', VALUE => 0 );
 
     my %res = ();
-    while ( my $ACE = $ACL->Next ) {
-        my $role = $ACE->PrincipalType;
-        my $type = $ACE->ObjectType;
+    foreach my $ACE ( @{ $ACL->ItemsArrayRef } ) {
+        my $role = $ACE->__Value('PrincipalType');
+        my $type = $ACE->__Value('ObjectType');
         if ( $type eq 'RT::System' ) {
             $res{ $role } = 1;
         }
         elsif ( $type eq 'RT::Queue' ) {
             next if $res{ $role } && !ref $res{ $role };
-            push @{ $res{ $role } ||= [] }, $ACE->ObjectId;
+            push @{ $res{ $role } ||= [] }, $ACE->__Value('ObjectId');
         }
         else {
             $RT::Logger->error('ShowTicket right is granted on unsupported object');
@@ -2954,8 +2954,8 @@ sub _DirectlyCanSeeIn {
     $ACL->Limit( ALIAS => $cgm_alias, FIELD => 'Disabled', VALUE => 0 );
 
     my @res = ();
-    while ( my $ACE = $ACL->Next ) {
-        my $type = $ACE->ObjectType;
+    foreach my $ACE ( @{ $ACL->ItemsArrayRef } ) {
+        my $type = $ACE->__Value('ObjectType');
         if ( $type eq 'RT::System' ) {
             # If user is direct member of a group that has the right
             # on the system then he can see any ticket
@@ -2963,7 +2963,7 @@ sub _DirectlyCanSeeIn {
             return (-1);
         }
         elsif ( $type eq 'RT::Queue' ) {
-            push @res, $ACE->ObjectId;
+            push @res, $ACE->__Value('ObjectId');
         }
         else {
             $RT::Logger->error('ShowTicket right is granted on unsupported object');

-----------------------------------------------------------------------


More information about the Rt-commit mailing list