rt 4.2.14 (#13852)
[freeside.git] / rt / share / html / Articles / Elements / NewestArticles
index e73dbbd..066656f 100644 (file)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
 <%INIT>
 my $rows = 10;
 my $i;
+
+my $Classes = RT::Classes->new($session{'CurrentUser'});
+$Classes->LimitToEnabled;
+my @classes;
+while (my $Class = $Classes->Next) {
+    push @classes, $Class->id if $Class->CurrentUserHasRight('ShowArticle');
+}
+
 my $MyArticles;
 $MyArticles = RT::Articles->new($session{'CurrentUser'});
-$MyArticles->UnLimit;
+$MyArticles->Limit(FIELD => 'Class', OPERATOR => 'IN', VALUE => \@classes)
+    if @classes;
 $MyArticles->RowsPerPage($rows);
 $MyArticles->OrderBy(FIELD => 'LastUpdated', ORDER => 'DESC');