[Rt-commit] rt branch, rightsmatrix, updated. rt-3.8.8-605-g7192803

Thomas Sibley trs at bestpractical.com
Mon Aug 30 15:33:58 EDT 2010


The branch, rightsmatrix has been updated
       via  71928032bf0ac78b9a139b0a163b3af901287e28 (commit)
      from  8e85e99d08dff694ee166b539d6f3dcb29e1033e (commit)

Summary of changes:
 lib/RT/Interface/Web.pm |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 71928032bf0ac78b9a139b0a163b3af901287e28
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Aug 30 15:36:05 2010 -0400

    Limit users and groups to those currently granted rights
    
    Also add order by clauses to all the queries for consistency

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 9bbee7a..780b85e 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2143,12 +2143,21 @@ sub GetPrincipalsMap {
         if (/System/) {
             my $system = RT::Groups->new($session{'CurrentUser'});
             $system->LimitToSystemInternalGroups();
+            $system->OrderBy( FIELD => 'Type', ORDER => 'ASC' );
             push @map, ['System' => $system => 'Type' => 1];
         }
         elsif (/Groups/) {
             my $groups = RT::Groups->new($session{'CurrentUser'});
             $groups->LimitToUserDefinedGroups();
-            # XXX TODO: only find those user groups with rights granted
+            $groups->OrderBy( FIELD => 'Name', ORDER => 'ASC' );
+
+            # Only show groups who have rights granted on this object
+            $groups->WithGroupRight(
+                Right   => '',
+                Object  => $object,
+                IncludeSystemRights => 0
+            );
+
             push @map, ['User Groups' => $groups => 'Name' => 0];
         }
         elsif (/Roles/) {
@@ -2164,6 +2173,7 @@ sub GetPrincipalsMap {
                 $RT::Logger->warn("Skipping unknown object type ($object) for Role principals");
                 next;
             }
+            $roles->OrderBy( FIELD => 'Type', ORDER => 'ASC' );
             push @map, ['Roles' => $roles => 'Type' => 1];
         }
         elsif (/Users/) {
@@ -2172,6 +2182,13 @@ sub GetPrincipalsMap {
             my $Users = $Privileged->UserMembersObj();
             $Users->OrderBy( FIELD => 'Name', ORDER => 'ASC' );
 
+            # Only show users who have rights granted on this object
+            $Users->WhoHaveGroupRight(
+                Right   => '',
+                Object  => $object,
+                IncludeSystemRights => 0
+            );
+
             my $display = sub {
                 $m->scomp('/Elements/ShowUser', User => $_[0], NoEscape => 1)
             };

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


More information about the Rt-commit mailing list