X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FGroups.pm;h=576c99dc9b5798a4b5a88e00fb240421ef716e7a;hb=31f3763747b82764bb019cfab5b2a2945fc9a99d;hp=578109c4f3155421724470a65ab33e08c5fad10a;hpb=c24d6e2242ae0e026684b8f95decf156aba6e75e;p=freeside.git diff --git a/rt/lib/RT/Groups.pm b/rt/lib/RT/Groups.pm index 578109c4f..576c99dc9 100755 --- a/rt/lib/RT/Groups.pm +++ b/rt/lib/RT/Groups.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -240,6 +240,15 @@ sub WithMember { return $members; } +sub WithCurrentUser { + my $self = shift; + $self->{with_current_user} = 1; + return $self->WithMember( + PrincipalId => $self->CurrentUser->PrincipalId, + Recursively => 1, + ); +} + sub WithoutMember { my $self = shift; my %args = ( @@ -392,7 +401,7 @@ sub ForWhichCurrentUserHasRight { =head2 LimitToEnabled -Only find items that haven\'t been disabled +Only find items that haven't been disabled =cut @@ -427,22 +436,16 @@ sub LimitToDeleted { -sub Next { +sub AddRecord { my $self = shift; + my ($record) = @_; - # Don't show groups which the user isn't allowed to see. + # If we've explicitly limited to groups the user is a member of (for + # dashboard or savedsearch privacy objects), skip the ACL. + return unless $self->{with_current_user} + or $record->CurrentUserHasRight('SeeGroup'); - my $Group = $self->SUPER::Next(); - if ((defined($Group)) and (ref($Group))) { - unless ($Group->CurrentUserHasRight('SeeGroup')) { - return $self->Next(); - } - - return $Group; - } - else { - return undef; - } + return $self->SUPER::AddRecord( $record ); } @@ -450,7 +453,7 @@ sub Next { sub _DoSearch { my $self = shift; - #unless we really want to find disabled rows, make sure we\'re only finding enabled ones. + #unless we really want to find disabled rows, make sure we're only finding enabled ones. unless($self->{'find_disabled_rows'}) { $self->LimitToEnabled(); }