[Rt-commit] rt branch, 4.4/hide-time-worked, created. rt-4.2.12-506-g1cbf2cd

Dustin Graves dustin at bestpractical.com
Fri Nov 20 17:17:01 EST 2015


The branch, 4.4/hide-time-worked has been created
        at  1cbf2cd8f1319b843fd9474d9211e31e5d797c4c (commit)

- Log -----------------------------------------------------------------
commit 1cbf2cd8f1319b843fd9474d9211e31e5d797c4c
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Fri Nov 20 21:54:31 2015 +0000

    add config HideTimeWorkedForUnprivilegedUsers to hide time worked, estimated, and left for unprivileged users
    
    Fixes: I#31302

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 1f9e0d0..cc38f5c 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1614,6 +1614,18 @@ Set($HideUnsetFieldsOnDisplay, 0);
 
 =back
 
+=item C<$HideTimeWorkedForUnprivilegedUsers>
+
+This determines if we should hide Time Worked, Time Estimated, and
+Time Left for unprivileged users.
+Set this to 1 to hide those fields.
+
+=cut
+
+Set($HideTimeWorkedForUnprivilegedUsers, 0);
+
+=back
+
 
 =head2 Articles
 
diff --git a/share/html/Elements/ShowHistoryPage b/share/html/Elements/ShowHistoryPage
index 884553c..11ee7c9 100644
--- a/share/html/Elements/ShowHistoryPage
+++ b/share/html/Elements/ShowHistoryPage
@@ -115,6 +115,13 @@ while ( my $Transaction = $Transactions->Next ) {
                  and $Object->RoleGroup( $Transaction->Field )->SingleMemberRoleGroupColumn;
     }
 
+    # Skip Time Worked fields if user is unprivileged and
+    # HideTimeWorkedForUnprivilegedUsers is set.
+    $skip = 1 if  $Object->isa("RT::Ticket") and
+                 ($Transaction->Field || '') =~ /(TimeEstimated|Worked|TimeLeft)/ and
+                 !$session{CurrentUser}->Privileged and
+                  RT->Config->Get('HideTimeWorkedForUnprivilegedUsers');
+
     $m->callback(
         %ARGS,
         Transaction   => $Transaction,
diff --git a/share/html/Ticket/Elements/ShowBasics b/share/html/Ticket/Elements/ShowBasics
index 2fc4098..3e30331 100644
--- a/share/html/Ticket/Elements/ShowBasics
+++ b/share/html/Ticket/Elements/ShowBasics
@@ -60,6 +60,7 @@
     <td class="value"><% loc($Ticket->SLA) %></td>
   </tr>
 % }
+% if ($show_time_worked) {
 % if ($Ticket->TimeEstimated) {
   <tr class="time estimated">
     <td class="label"><&|/l&>Estimated</&>:</td>
@@ -95,6 +96,7 @@
     <td class="value"><& ShowTime, minutes => $Ticket->TimeLeft &></td>
   </tr>
 % }
+% }
 % $m->callback( %ARGS, CallbackName => 'AfterTimeLeft', TicketObj => $Ticket );
   <tr class="priority">
     <td class="label"><&|/l&>Priority</&>:</td>
@@ -122,7 +124,8 @@ $UngroupedCFs => 0
 </%ARGS>
 <%init>
 my $time_worked;
-if ( $Ticket->TimeWorked ) {
+my $show_time_worked = $session{CurrentUser}->Privileged || !RT->Config->Get('HideTimeWorkedForUnprivilegedUsers');
+if ( $show_time_worked && $Ticket->TimeWorked ) {
     my $time_worked_attr = $Ticket->FirstAttribute('TimeWorked');
 
     if ($time_worked_attr) {

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


More information about the rt-commit mailing list