[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.3-77-gf834edcbe

? sunnavy sunnavy at bestpractical.com
Mon Nov 26 12:26:51 EST 2018


The branch, 4.4-trunk has been updated
       via  f834edcbe015b60c61adfb14ce3a2d686cc4c3e3 (commit)
       via  c37e09f46c916f40fae9562d4d6ea9b50cb057c2 (commit)
       via  afbcfe82a4678c5921d2475689e7445d4f6dbcc2 (commit)
       via  0e35a975952f820e2a40f5a02f34af63488a6462 (commit)
       via  110ee095a1d8b6c6524ceb34e2a7648a19634711 (commit)
       via  e979213918c3754d3a8b7c2230a527fdbca1dc16 (commit)
       via  ac2bfaec7e2861ea92489b9b5a24a07f10edfc2c (commit)
       via  233bf58a09f42de47ebcc9c3a069e811631942fc (commit)
       via  98e98599076bba8cd02b4a88584494c6e4788a6b (commit)
       via  0aad7cfc6c5114a65c67d7b8ac2f0ed57a9c81b7 (commit)
      from  96f750eadec61ca0da3b66ee6bdbd4155e065e5f (commit)

Summary of changes:
 etc/RT_Config.pm.in                                | 44 +++++++++++
 share/html/Admin/Users/Modify.html                 |  1 +
 share/html/Elements/RT__Transaction/ColumnMap      |  4 +
 share/html/Prefs/AboutMe.html                      |  6 ++
 share/html/SelfService/Prefs.html                  |  4 +
 .../Search/Results.tsv}                            |  2 +-
 .../User/Elements/RelatedData}                     | 27 ++++---
 .../User/RelatedData.tsv}                          |  2 +-
 .../QueueList => User/Elements/RelatedData}        | 27 ++++---
 .../{Search/Results.tsv => User/RelatedData.tsv}   | 47 +++++++-----
 t/web/download_user_info.t                         | 85 ++++++++++++++++++++++
 11 files changed, 206 insertions(+), 43 deletions(-)
 copy share/html/{Elements/EditCustomFieldIPAddressRange => SelfService/Search/Results.tsv} (97%)
 copy share/html/{Elements/QueueList => SelfService/User/Elements/RelatedData} (73%)
 copy share/html/{Elements/EditCustomFieldIPAddressRange => SelfService/User/RelatedData.tsv} (97%)
 copy share/html/{Elements/QueueList => User/Elements/RelatedData} (74%)
 copy share/html/{Search/Results.tsv => User/RelatedData.tsv} (61%)
 create mode 100644 t/web/download_user_info.t

- Log -----------------------------------------------------------------
commit afbcfe82a4678c5921d2475689e7445d4f6dbcc2
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Wed Nov 21 16:25:09 2018 -0500

    Config option to allow self service users to download their user data

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 020044cea..2189640ba 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1831,6 +1831,16 @@ access ticked displays.
 
 Set($SelfServiceRegex, qr!^(?:/+SelfService/)!x );
 
+=item C<$SelfServiceDownloadUserData>
+
+Allow Self Service users to download their user information, ticket data
+and transaction data as a .tsv file. When enabled, these three options
+will appear on the /SelfService/Prefs.html page.
+
+=cut
+
+Set( $SelfServiceDownloadUserData, 0 );
+
 =back
 
 =head2 Articles
diff --git a/share/html/SelfService/Prefs.html b/share/html/SelfService/Prefs.html
index 85bfe786c..ec24c5c6c 100644
--- a/share/html/SelfService/Prefs.html
+++ b/share/html/SelfService/Prefs.html
@@ -81,7 +81,9 @@
 <& /Elements/Submit, Label => loc('Save Changes') &>
 </form>
 
+% if( RT->Config->Get('SelfServiceDownloadUserData') ) {
 <& /SelfService/User/Elements/RelatedData, UserObj => $user &>
+% }
 
 <%INIT>
 my @results;

commit c37e09f46c916f40fae9562d4d6ea9b50cb057c2
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Thu Jun 14 15:56:19 2018 -0400

    Create test for user information TSV download
    
    Create tests to test the user personal identifying information download
    features.

diff --git a/t/web/download_user_info.t b/t/web/download_user_info.t
new file mode 100644
index 000000000..cc100d686
--- /dev/null
+++ b/t/web/download_user_info.t
@@ -0,0 +1,85 @@
+
+use strict;
+use warnings;
+
+use RT::Test tests => undef;
+
+RT->Config->Set( UserTicketDataResultFormat =>
+        "'__id__', '__Subject__', '__Status__', '__QueueName__', '__Owner__', '__Priority__', '__Requestors__'"
+);
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+my $url = $agent->rt_base_url;
+
+# Login
+$agent->login( 'root' => 'password' );
+
+{
+    my $root = RT::Test->load_or_create_user( Name => 'root' );
+    ok $root && $root->id;
+
+# We want transactions attached to our user, so not using test method for ticket create
+    my $ticket = RT::Ticket->new($root);
+    $ticket->Create(
+        Subject   => 'Test',
+        Requestor => 'root',
+        Queue     => 'General'
+    );
+    my $id = $ticket->id;
+    ok $id;
+
+    $ticket->Comment( Content => 'Test - Comment' );
+    $ticket->Correspond( Content => 'Test - Reply' );
+
+    my @dates;
+    my $trans = $ticket->Transactions;
+
+    while ( my $tran = $trans->Next ) {
+        if ( $tran->Type =~ /Create|Comment|Correspond/ ) {
+            push @dates, $tran->CreatedObj->AsString;
+        }
+    }
+    my ( $date_created, $date_commented, $date_correspondence ) = @dates;
+
+    # Make sure we have the expected amount of transactions
+    is scalar @dates, 3;
+
+    # TSV file for user record information
+    $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $root->id );
+    $agent->follow_link_ok( { text => 'Download User Data' } );
+
+    my $user_info_tsv = <<EOF;
+id\tName\tEmailAddress\tRealName\tNickName\tOrganization\tHomePhone\tWorkPhone\tMobilePhone\tPagerPhone\tAddress1\tAddress2\tCity\tState\tZip\tCountry\tGecos\tLang\tFreeFormContactInfo
+14\troot\troot\@localhost\tEnoch Root\t\t\t\t\t\t\t\t\t\t\t\t\troot\t\t
+EOF
+
+    is $agent->content, $user_info_tsv,
+        "User record information downloaded correctly";
+
+    # TSV file for Transactions
+    $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $root->id );
+    $agent->follow_link_ok( { text => 'Download User Transaction Data' } );
+
+    my $transaction_info_tsv = <<EOF;
+ObjectId\tid\tCreated\tDescription\tOldValue\tNewValue\tContent
+1\t30\t$date_created\tTicket created\t\t\tThis transaction appears to have no content
+1\t32\t$date_commented\tComments added\t\t\tTest - Comment
+1\t33\t$date_correspondence\tCorrespondence added\t\t\tTest - Reply
+EOF
+
+    is $agent->content, $transaction_info_tsv,
+        "User transaction information downloaded correctly";
+
+    # TSV file for user's Tickets
+    $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $root->id );
+    $agent->follow_link_ok( { text => 'Download User Tickets' } );
+
+    my $ticket_info_tsv = <<EOF;
+id\tSubject\tStatus\tQueueName\tOwner\tPriority\tRequestors
+1\tTest\topen\tGeneral\tNobody in particular\t0\troot (Enoch Root)
+EOF
+
+    is $agent->content, $ticket_info_tsv, "User tickets downloaded correctly";
+}
+
+done_testing();

commit f834edcbe015b60c61adfb14ce3a2d686cc4c3e3
Merge: 96f750ead c37e09f46
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 27 00:48:16 2018 +0800

    Merge branch '4.4/download-user-info' into 4.4-trunk

diff --cc etc/RT_Config.pm.in
index 4c38d555c,2189640ba..17d912e69
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@@ -1798,54 -1831,16 +1831,65 @@@ access ticked displays
  
  Set($SelfServiceRegex, qr!^(?:/+SelfService/)!x );
  
 +=item C<$SelfServiceUserPrefs>
 +
 +This option controls how the SelfService user preferences page is
 +displayed. It accepts a string from one of the four possible modes
 +below.
 +
 +=over
 +
 +=item C<edit-prefs> (the default)
 +
 +When set to C<edit-prefs>, self service users will be able to update
 +their Timezone and Language preference and update their password.
 +This is the default behavior of RT.
 +
 +=item C<view-info>
 +
 +When set to C<view-info>, users will have full access to all their
 +user information stored in RT on a read-only page.
 +
 +=item C<edit-prefs-view-info>
 +
 +When set to C<edit-prefs-view-info>, users will have full access as in
 +the C<view-info> option, but also will be able to update their Locale
 +and password as in the default C<edit-prefs> option.
 +
 +=item C<full-edit>
 +
 +When set to C<full-edit>, users will be able to fully view and update
 +all of their stored RT user information.
 +
 +=back
 +
 +=cut
 +
 +Set($SelfServiceUserPrefs, 'edit-prefs');
 +
 +=item C<$SelfServiceRequestUpdatePortlet>
 +
 +Set this to 1 to allow Self Service users to request updates to
 +their RT user information. When enabled, this portlet adds a quick
 +ticket create portlet to the Self Service preferences page. This
 +option is only available when $SelfServiceUserPrefs is set to
 +'view-info' or 'edit-prefs-view-info'.
 +
 +=cut
 +
 +Set($SelfServiceRequestUpdatePortlet, 0);
 +
+ =item C<$SelfServiceDownloadUserData>
+ 
+ Allow Self Service users to download their user information, ticket data
+ and transaction data as a .tsv file. When enabled, these three options
+ will appear on the /SelfService/Prefs.html page.
+ 
+ =cut
+ 
+ Set( $SelfServiceDownloadUserData, 0 );
+ 
++
  =back
  
  =head2 Articles
diff --cc share/html/SelfService/Prefs.html
index d53c6a8e6,ec24c5c6c..19644c981
--- a/share/html/SelfService/Prefs.html
+++ b/share/html/SelfService/Prefs.html
@@@ -85,14 -81,10 +85,18 @@@
  <& /Elements/Submit, Label => loc('Save Changes') &>
  </form>
  
 +% }
 +% if ( $pref eq 'view-info' || $pref eq 'edit-prefs-view-info' ) {
 +<& /Prefs/Elements/ShowAboutMe, UserObj => $user &>
 +%    if ( $request_portlet ) {
 +<& Elements/RequestUpdate, User=> $user &>
 +%    }
 +% }
 +
+ % if( RT->Config->Get('SelfServiceDownloadUserData') ) {
+ <& /SelfService/User/Elements/RelatedData, UserObj => $user &>
+ % }
+ 
  <%INIT>
  my @results;
  

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


More information about the rt-commit mailing list