[Rt-commit] rt branch, 4.4/download-user-info, repushed
Craig Kaiser
craig at bestpractical.com
Fri Jun 15 11:48:45 EDT 2018
The branch 4.4/download-user-info was deleted and repushed:
was 1035e04c84f8541c2f2c11a2ba0d84ea19df5fb1
now 90105ad36e7c275f5c71178dcefc8586646a74a1
1: 0837d00cc < --: ------- Add option to disable escaping HTML in articles
2: d933dbc30 < --: ------- Updated Articles docs to include disabling escaped HTML
3: 444232a01 < --: ------- Update article postfix loops from using $_ to a named variable
4: d3f769cb2 < --: ------- Add keyboard shortcuts for reply and comment
5: e5e0327b5 < --: ------- Allow rt-setup-fulltext-index to prompt for dba password
6: 72f02a602 < --: ------- Fix typo in POD
7: 17a8d61a2 = 1: a7061699c Add column to transaction column map for content
--: ------- > 2: 1f08f64e1 Add 'UserDataSearchResultFormat' config option
9: aa3803df1 ! 3: cacec40fd Create helper for exporting user related information
@@ -64,30 +64,30 @@
+</%ARGS>
+
+<%INIT>
++# Abort unless supported type for export found
++$m->abort unless
++ $Type && ( $Type eq 'User' || $Type eq 'Transaction');
++
+my $Collection;
+my $Format;
+
-+my $user = RT::User->new($session{'CurrentUser'});
-+my ($ret, $msg) = $user->Load($session{'CurrentUser'});
-+RT::Logger->error($msg) unless $ret;
-+
-+if ( defined $Type && $Type eq 'User' ) {
++if ( $Type eq 'User' ) {
+ $Format = "'__id__', '__Name__', '__EmailAddress__', '__RealName__', '__NickName__', '__Organization__', '__HomePhone__', '__WorkPhone__','__MobilePhone__', '__PagerPhone__', '__Address1__', '__Address2__', '__City__', '__State__','__Zip__', '__Country__', '__Gecos__', '__Lang__', '__FreeFormContactInfo__'";
+
+ $Collection = RT::Users->new($session{'CurrentUser'});
-+ $Collection->Limit( FIELD => 'id', VALUE => $user->id );
++ $Collection->Limit( FIELD => 'id', VALUE => $session{'CurrentUser'}->id );
+
-+} elsif ( defined $Type && $Type eq 'Transaction' ) {
++} elsif ( $Type eq 'Transaction' ) {
+ $Format = "'__ObjectId__', '__id__', '__Created__', '__Description__', '__OldValue__', '__NewValue__', '__Content__'";
+
+ $Collection = RT::Transactions->new($session{'CurrentUser'});
+ $Collection->Limit( FIELD => 'ObjectType', VALUE => 'RT::Ticket' );
-+ $Collection->Limit( FIELD => 'Creator', VALUE => $user->Id );
++ $Collection->Limit( FIELD => 'Creator', VALUE => $session{'CurrentUser'}->Id );
+ $Collection->Limit( FIELD => 'Type', VALUE => 'Create' );
+ $Collection->Limit( FIELD => 'Type', VALUE => 'Correspond' );
+ $Collection->Limit( FIELD => 'Type', VALUE => 'Comment' );
+}
+
-+$m->comp( "/Elements/TSVExport", Collection => $Collection, Format => $Format, PreserveNewLines => $PreserveNewLines ) unless !defined $Type;
++$m->comp( "/Elements/TSVExport", Collection => $Collection, Format => $Format, PreserveNewLines => $PreserveNewLines );
+</%INIT>
8: 64dacf4dc ! 4: 9a8c70327 Create portlet for downloading user information
@@ -1,11 +1,6 @@
Author: Craig Kaiser <craig at bestpractical.com>
Create portlet for downloading user information
-
- Offer users the option to download their personal
- identifying information stored in RT. Allow users to choose to download a TSV file
- of relevant user record information, ticket information or transaction
- information.
diff --git a/share/html/Elements/MyRelatedInfo b/share/html/Elements/MyRelatedInfo
new file mode 100644
@@ -63,27 +58,15 @@
+ class => 'user-related-info',
+ title => loc("User related info"),
+&>
-+% # Only show these options when current user is viewing themselves
-+% if ( defined $UserObj->id && defined $user->id && $UserObj->id == $user->id ) {
++
+<div>
-+ <div>
-+ <a href="/Helpers/MyRelatedInfo.tsv?Type=User&UserId=<% $UserObj->id %>" class="button">Download My User Info</a>
-+ <a href="/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>" class="button">Download My Tickets</a>
-+ <a href="/Helpers/MyRelatedInfo.tsv?Type=Transaction&UserId=<% $UserObj->id %>" class="button">Download My Transaction Info</a>
-+ </div>
++ <a href="/Helpers/MyRelatedInfo.tsv?Type=User&UserId=<% $session{'CurrentUser'}->id %>" class="button"><&|/l&>Download My User Info</&></a>
++ <a href="/Search/Results.tsv?Query=Requestor.id=<% $session{'CurrentUser'}->id %>&Format=<% $Format | un %>" class="button"><&|/l&>Download My Tickets</&></a>
++ <a href="/Helpers/MyRelatedInfo.tsv?Type=Transaction&UserId=<% $session{'CurrentUser'}->id %>" class="button"><&|/l&>Download My Transaction Info</&></a>
+</div>
-+% }
+</&>
+
+<%INIT>
+my $Format = RT->Config->Get('UserDataSearchResultFormat') || RT->Config->Get('DefaultSearchResultFormat');
-+
-+my $user = RT::User->new($session{CurrentUser});
-+my ($ret, $msg) = $user->Load($session{CurrentUser});
-+RT::Logger->error($msg) unless $ret;
+</%INIT>
-+
-+<%ARGS>
-+$UserObj
-+</%ARGS>
10: 20bdce30d ! 5: d6d820155 Add user download portlet to admin user modify page
@@ -1,6 +1,6 @@
Author: Craig Kaiser <craig at bestpractical.com>
- Add user download portlet to Admin modify page
+ Add user download portlet to admin user modify page
diff --git a/share/html/Admin/Users/Modify.html b/share/html/Admin/Users/Modify.html
--- a/share/html/Admin/Users/Modify.html
@@ -9,7 +9,10 @@
% }
</form>
-+<& /Elements/MyRelatedInfo, UserObj => $UserObj &>
++%# Only show if current user is on their modify page
++% if ( !$Create && $session{'CurrentUser'}->id == $UserObj->id ) {
++<& /Elements/MyRelatedInfo &>
++% }
+
<%INIT>
11: 271340037 < --: ------- Create test for user PII TSV download
12: 1035e04c8 < --: ------- Add 'UserDataSearchResultFormat' config option
--: ------- > 6: 90105ad36 Create test for user information TSV download
More information about the rt-commit
mailing list