[Rt-commit] rt branch, dashboard-acl-query, updated. rt-3.9.6-366-gbdfff71

Shawn Moore sartak at bestpractical.com
Mon Dec 6 16:17:46 EST 2010


The branch, dashboard-acl-query has been updated
       via  bdfff712437663f703c51f733a499288b89e26e2 (commit)
      from  0755275d38687dd96d67f331cc4f90c25ba50974 (commit)

Summary of changes:
 lib/RT/Dashboard.pm |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit bdfff712437663f703c51f733a499288b89e26e2
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Dec 6 16:17:22 2010 -0500

    Override ObjectsForLoading to make it faster with a more direct query

diff --git a/lib/RT/Dashboard.pm b/lib/RT/Dashboard.pm
index 6c5a7c6..09e9a2c 100644
--- a/lib/RT/Dashboard.pm
+++ b/lib/RT/Dashboard.pm
@@ -363,6 +363,28 @@ sub Subscription {
     return;
 }
 
+sub ObjectsForLoading {
+    my $self = shift;
+    my @objects;
+
+    my $CurrentUser = $self->CurrentUser;
+    push @objects, $CurrentUser->UserObj
+        if $CurrentUser->HasRight(Object => $RT::System, 'SeeOwnDashboard');
+
+
+    my $groups = RT::Groups->new($CurrentUser);
+    $groups->ForWhichCurrentUserHasRight(
+        Right             => 'SeeGroupDashboard',
+        IncludeSuperusers => 1,
+    );
+    push @objects, @{ $groups->ItemsArrayRef };
+
+
+    push @objects, RT::System->new($CurrentUser)
+        if $CurrentUser->HasRight(Object => $RT::System, 'SeeDashboard');
+
+    return @objects;
+}
 
 RT::Base->_ImportOverlays();
 

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


More information about the Rt-commit mailing list