[Rt-commit] rt branch, 5.0-trunk, updated. rt-5.0.0alpha1-80-g0069914977

? sunnavy sunnavy at bestpractical.com
Wed Apr 8 13:52:41 EDT 2020


The branch, 5.0-trunk has been updated
       via  006991497733d6177449e6f5a209815f84cd51da (commit)
       via  0d14950bf40634a168980c4bfd6fd97d8bf73996 (commit)
       via  ef0b83a14d766bd13d29878d32d0a4118c0c85a3 (commit)
      from  19cdc5650c9761fff552a3dcd05c4d663d5b93c2 (commit)

Summary of changes:
 lib/RT/Interface/Web/MenuBuilder.pm    |  3 ++-
 share/html/Ticket/Elements/ShowSummary | 12 ++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit ef0b83a14d766bd13d29878d32d0a4118c0c85a3
Author: michel <michel at bestpractical.com>
Date:   Fri Mar 20 19:41:10 2020 +0100

    Bug fix: use the right CurrentUserCanSetOwner return value.
    
    CurrentUserCanSetOwner returns ($ok, $msg), not a boolean.

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 8852112603..b99063629d 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -319,7 +319,8 @@ sub BuildMainNav {
                 my $actions = $page->child( actions => title => loc('Actions'), sort_order  => 95 );
 
                 my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) };
-                $can{'_ModifyOwner'} = $obj->CurrentUserCanSetOwner();
+                # since CurrentUserCanSetOwner returns ($ok, $msg), the parens ensure that $can{} gets $ok
+                ( $can{'_ModifyOwner'} ) = $obj->CurrentUserCanSetOwner();
                 my $can = sub {
                     unless ($_[0] eq 'ExecuteCode') {
                         return $can{$_[0]} || $can{'SuperUser'};
diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index 0c5ffdab9b..f8638caa5d 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -226,7 +226,7 @@ $InlineEdit => 0
 <%INIT>
 my $can_modify = $Ticket->CurrentUserHasRight('ModifyTicket');
 my $can_modify_cf = $Ticket->CurrentUserHasRight('ModifyCustomField');
-my $can_modify_owner = $Ticket->CurrentUserCanSetOwner();
+my ($can_modify_owner) = $Ticket->CurrentUserCanSetOwner();
 my $can_modify_people = $Ticket->CurrentUserHasRight('Watch')
                      || $Ticket->CurrentUserHasRight('WatchAsAdminCc');
 

commit 0d14950bf40634a168980c4bfd6fd97d8bf73996
Author: michel <michel at bestpractical.com>
Date:   Fri Mar 20 20:14:41 2020 +0100

    Hide the pencil icon if the user doesn't have the rights.
    
    On the ticket display page, only display the pencil icon if the
    user can modify data in the portlet.

diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index f8638caa5d..2b4d0f958c 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -64,7 +64,7 @@ my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{Basics} || $inline_ed
 
     <&| /Widgets/TitleBox, title => loc('The Basics'),
         (($can_modify || $can_modify_cf) ? (title_href => $modify_url) : ()),
-        ($modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $modify_basics) : ()),
+        (($can_modify || $can_modify_cf) && $modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $modify_basics) : ()),
         class => (join " ", 'ticket-info-basics', ($modify_behavior eq 'always' ? 'editing' : ())),
         data => { 'inline-edit-behavior' => $modify_behavior },
     &>
@@ -90,7 +90,7 @@ my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{Basics} || $inline_ed
     <& /Elements/ShowCustomFieldCustomGroupings,
         Object       => $Ticket,
         title_href   => ($can_modify || $can_modify_cf) ? RT->Config->Get('WebPath')."/Ticket/Modify.html" : "",
-        InlineEdit   => $InlineEdit,
+        InlineEdit   => ($can_modify || $can_modify_cf) ? $InlineEdit : 0,
         &>
 
 <%PERL>
@@ -101,7 +101,7 @@ my $people_behavior = $InlineEdit ? ($inline_edit_behavior{People} || $inline_ed
     <&| /Widgets/TitleBox, title => loc('People'),
         (($can_modify || $can_modify_owner || $can_modify_people) ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id) : ()),
         class => (join " ", 'ticket-info-people', ($people_behavior eq 'always' ? 'editing' : ())),
-        ($people_behavior =~ /^(link|click)$/ ? (titleright_raw => $people_inline) : ()),
+        (($can_modify || $can_modify_owner || $can_modify_people) && $people_behavior =~ /^(link|click)$/ ? (titleright_raw => $people_inline) : ()),
         data => { 'inline-edit-behavior' => $people_behavior },
     &>
 %       unless ($people_behavior eq 'always') {
@@ -150,7 +150,7 @@ my $dates_behavior = $InlineEdit ? ($inline_edit_behavior{Dates} || $inline_edit
     <&| /Widgets/TitleBox, title => loc("Dates"),
         ($can_modify ? (title_href => $dates_url) : ()),
         class => (join " ", 'ticket-info-dates', ($dates_behavior eq 'always' ? 'editing' : ())),
-        ($dates_behavior =~ /^(link|click)$/ ? (titleright_raw => $dates_inline) : ()),
+        ($can_modify && $dates_behavior =~ /^(link|click)$/ ? (titleright_raw => $dates_inline) : ()),
         data => { 'inline-edit-behavior' => $dates_behavior },
     &>
 %       unless ($dates_behavior eq 'always') {
@@ -180,7 +180,7 @@ my $alt = loc('Graph ticket links');
 my $links_graph = '<a href="' . RT->Config->Get('WebPath') . '/Ticket/Graphs/index.html?id=' . $Ticket->id . '"><span class="fas fa-project-diagram icon-bordered fa-2x" alt="' . $alt . '" data-toggle="tooltip" data-placement="top" data-original-title="' . $alt . '"></span></a>';
 
 my $links_titleright = join ' ',
-    ($links_behavior =~ /^(link|click)$/ ? ($links_inline) : ()),
+    ($can_modify && $links_behavior =~ /^(link|click)$/ ? ($links_inline) : ()),
     (RT->Config->Get('DisableGraphViz') ? () : $links_graph);
 my @extra;
 push @extra, (titleright_raw => $links_titleright) if $links_titleright;

commit 006991497733d6177449e6f5a209815f84cd51da
Merge: 19cdc5650c 0d14950bf4
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Apr 9 01:41:35 2020 +0800

    Merge branch '5.0/hide-pencil-button-if-no-rights' into 5.0-trunk


-----------------------------------------------------------------------


More information about the rt-commit mailing list