X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FTemplates.pm;h=06d2191edadc079cbed48db5938241cc8214f876;hb=31f3763747b82764bb019cfab5b2a2945fc9a99d;hp=be571f096a50e2af3252fdd82f7db6b886154d75;hpb=f3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7;p=freeside.git diff --git a/rt/lib/RT/Templates.pm b/rt/lib/RT/Templates.pm index be571f096..06d2191ed 100755 --- a/rt/lib/RT/Templates.pm +++ b/rt/lib/RT/Templates.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) @@ -125,37 +125,19 @@ sub LimitToQueue { } -=head2 Next +=head2 AddRecord -Returns the next template that this user can see. +Overrides the collection to ensure that only templates the user can see +are returned. =cut - -sub Next { + +sub AddRecord { my $self = shift; - - - my $templ = $self->SUPER::Next(); - if ((defined($templ)) and (ref($templ))) { - - # If it's part of a queue, and the user can read templates in - # that queue, or the user can globally read templates, show it - if ($templ->Queue && $templ->CurrentUserHasQueueRight('ShowTemplate') or - $templ->CurrentUser->HasRight(Object => $RT::System, Right => 'ShowTemplate') or - $templ->CurrentUser->HasRight(Object => $RT::System, Right => 'ShowGlobalTemplates')) { - return($templ); - } - - #If the user doesn't have the right to show this template - else { - return($self->Next()); - } - } - #if there never was any template - else { - return(undef); - } - + my ($record) = @_; + + return unless $record->CurrentUserCanRead; + return $self->SUPER::AddRecord( $record ); } =head2 NewItem