diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-06-12 15:19:00 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-06-12 15:19:00 -0700 |
commit | 919e930aa9279b3c5cd12b593889cd6de79d67bf (patch) | |
tree | 77d7b94eb2050ea8d7bee2431dbb11d34abe9249 /rt/lib/RT/Templates.pm | |
parent | f303acf0bfdbd5debea67d391e111ae4ee62cb78 (diff) |
rt 4.0.23
Diffstat (limited to 'rt/lib/RT/Templates.pm')
-rwxr-xr-x | rt/lib/RT/Templates.pm | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/rt/lib/RT/Templates.pm b/rt/lib/RT/Templates.pm index 7d117fae3..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-2014 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # <sales@bestpractical.com> # # (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 |