[Rt-commit] rt branch, 5.0/add-self-service-article-components, repushed

Dianne Skoll dianne at bestpractical.com
Mon Nov 30 09:07:49 EST 2020


The branch 5.0/add-self-service-article-components was deleted and repushed:
       was 16fb6c4cf9bdbe2f309c531b873876d352d82d9c
       now 8d13c41de269fc9860f371646a56b861c8a49151

1: 2c6bd12b37 ! 1: 8d13c41de2 Add components to self-service dashboard to show Top or Newest articles.
    @@ -1,6 +1,14 @@
     Author: Dianne Skoll <dianne at bestpractical.com>
     
         Add components to self-service dashboard to show Top or Newest articles.
    +    
    +    Git is claiming that Article/autohandler was renamed to
    +    ../Elements/SelfServiceNewestArticles, but that is wrong; the
    +    rename-detection algorithm failed.
    +    
    +    The autohandler was unnecessary and has been deleted; its permission
    +    check was wrong.  The existing permission checks in
    +    Elements/SelfService* are correct and sufficient.
     
     diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
     --- a/etc/RT_Config.pm.in
    @@ -10,81 +18,43 @@
          $SelfServicePageComponents,
          [
     -        qw(QuickCreate QueueList MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SavedSearches FindUser MyAssets FindAsset FindGroup) # loc_qw
    -+        qw(/SelfService/Elements/TopArticles /SelfService/Elements/NewestArticles)
    ++        qw(SelfServiceTopArticles SelfServiceNewestArticles)
          ]
      );
      
    -+=item C<$SelfServiceArticleClass>
    -+
    -+C<$SelfServiceArticleClass> specifies the article class that self-service
    -+users can see in their TopArticles or NewestArticles portlet.
    -+
    -+=cut
    -+
    -+Set($SelfServiceArticleClass, 'General');
    -+
    - =back
    +-=back
    +-
    + =head2 Articles
      
    - =head2 Articles
    -
    -diff --git a/share/html/SelfService/Elements/NewestArticles b/share/html/SelfService/Elements/NewestArticles
    + =over 4
    +
    +diff --git a/share/html/SelfService/Article/autohandler b/share/html/Elements/SelfServiceNewestArticles
    +similarity index 87%
    +rename from share/html/SelfService/Article/autohandler
    +rename to share/html/Elements/SelfServiceNewestArticles
    +--- a/share/html/SelfService/Article/autohandler
    ++++ b/share/html/Elements/SelfServiceNewestArticles
    +@@
    + %# those contributions and any derivatives thereof.
    + %#
    + %# END BPS TAGGED BLOCK }}}
    +-<%INIT>
    +-
    +-if ( $session{'CurrentUser'}->HasRight( Right => 'ShowArticle',
    +-                   Object => $RT::System )) {
    +-    $m->comp( { base_comp => $m->request_comp }, $m->fetch_next, %ARGS);    
    +-}
    +-else {
    +-    RT::Interface::Web::Redirect($RT::WebURL."SelfService/");
    +-}
    +-
    +-</%INIT>
    ++<& /Elements/SelfServiceShowArticles &>
    +
    +diff --git a/share/html/Elements/SelfServiceShowArticles b/share/html/Elements/SelfServiceShowArticles
     new file mode 100644
     --- /dev/null
    -+++ b/share/html/SelfService/Elements/NewestArticles
    -@@
    -+%# BEGIN BPS TAGGED BLOCK {{{
    -+%#
    -+%# COPYRIGHT:
    -+%#
    -+%# This software is Copyright (c) 1996-2020 Best Practical Solutions, LLC
    -+%#                                          <sales at bestpractical.com>
    -+%#
    -+%# (Except where explicitly superseded by other copyright notices)
    -+%#
    -+%#
    -+%# LICENSE:
    -+%#
    -+%# This work is made available to you under the terms of Version 2 of
    -+%# the GNU General Public License. A copy of that license should have
    -+%# been provided with this software, but in any event can be snarfed
    -+%# from www.gnu.org.
    -+%#
    -+%# This work is distributed in the hope that it will be useful, but
    -+%# WITHOUT ANY WARRANTY; without even the implied warranty of
    -+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -+%# General Public License for more details.
    -+%#
    -+%# You should have received a copy of the GNU General Public License
    -+%# along with this program; if not, write to the Free Software
    -+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    -+%# 02110-1301 or visit their web page on the internet at
    -+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
    -+%#
    -+%#
    -+%# CONTRIBUTION SUBMISSION POLICY:
    -+%#
    -+%# (The following paragraph is not intended to limit the rights granted
    -+%# to you to modify and distribute this software under the terms of
    -+%# the GNU General Public License and is only of importance to you if
    -+%# you choose to contribute your changes and enhancements to the
    -+%# community by submitting them to Best Practical Solutions, LLC.)
    -+%#
    -+%# By intentionally submitting any modifications, corrections or
    -+%# derivatives to this work, or any other work intended for use with
    -+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
    -+%# you are the copyright holder for those contributions and you grant
    -+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
    -+%# royalty-free, perpetual, license to use, copy, create derivative
    -+%# works based on those contributions, and sublicense and distribute
    -+%# those contributions and any derivatives thereof.
    -+%#
    -+%# END BPS TAGGED BLOCK }}}
    -+<& /SelfService/Elements/ShowArticles &>
    -
    -diff --git a/share/html/SelfService/Elements/ShowArticles b/share/html/SelfService/Elements/ShowArticles
    -new file mode 100644
    ---- /dev/null
    -+++ b/share/html/SelfService/Elements/ShowArticles
    ++++ b/share/html/Elements/SelfServiceShowArticles
     @@
     +%# BEGIN BPS TAGGED BLOCK {{{
     +%#
    @@ -157,13 +127,26 @@
     +<%INIT>
     +my $i;
     +
    -+my $class = RT::Class->new($session{'CurrentUser'});
    -+$class->Load(RT::Config->Get('SelfServiceArticleClass'));
    -+my @classes = ($class->Id);
    ++# Get a list of classes for which current user has "ShowArticle" right.
    ++# We get the list of classes as RT->SystemUser; if we didn't do that,
    ++# we would have to grant the "SeeClass" right to self-service users
    ++# as well as the "ShowArticle" right.
    ++my $Classes = RT::Classes->new(RT->SystemUser);
    ++$Classes->LimitToEnabled;
    ++my @classes;
    ++while (my $c = $Classes->Next) {
    ++    push(@classes, $c->id) if $c->CurrentUserHasRight('ShowArticle');
    ++}
    ++
    ++# If the user does not have access to any article classes, then we need
    ++# to prohibit any articles from being shown.
    ++if (!scalar(@classes)) {
    ++    push(@classes, -1);  # -1 can never be the ID of a valid article class
    ++}
    ++
     +my $MyArticles;
     +$MyArticles = RT::Articles->new($session{'CurrentUser'});
    -+$MyArticles->Limit(FIELD => 'Class', OPERATOR => 'IN', VALUE => \@classes)
    -+    if @classes;
    ++$MyArticles->Limit(FIELD => 'Class', OPERATOR => 'IN', VALUE => \@classes);
     +$MyArticles->RowsPerPage($rows);
     +$MyArticles->OrderBy(FIELD => $orderby_field, ORDER => $sortorder);
     +
    @@ -175,10 +158,10 @@
     +$title         => loc("[_1] Newest Articles", $rows)
     +</%ARGS>
     
    -diff --git a/share/html/SelfService/Elements/TopArticles b/share/html/SelfService/Elements/TopArticles
    +diff --git a/share/html/Elements/SelfServiceTopArticles b/share/html/Elements/SelfServiceTopArticles
     new file mode 100644
     --- /dev/null
    -+++ b/share/html/SelfService/Elements/TopArticles
    ++++ b/share/html/Elements/SelfServiceTopArticles
     @@
     +%# BEGIN BPS TAGGED BLOCK {{{
     +%#
    @@ -227,5 +210,4 @@
     +%# those contributions and any derivatives thereof.
     +%#
     +%# END BPS TAGGED BLOCK }}}
    -+<& /SelfService/Elements/ShowArticles, orderby_field => 'SortOrder', sortorder => 'Desc', title => loc('[_1] Top Articles', 10), rows => 10 &>
    -
    ++<& /Elements/SelfServiceShowArticles, orderby_field => 'SortOrder', sortorder => 'Desc', title => loc('[_1] Top Articles', 10), rows => 10 &>
2: 16fb6c4cf9 < -:  ------- Remove unnecessary autohandler that was blocking articles from being displayed.



More information about the rt-commit mailing list