[Rt-commit] rt branch, 4.4/remove-user-info, repushed

Craig Kaiser craig at bestpractical.com
Thu Jun 7 20:26:30 EDT 2018


The branch 4.4/remove-user-info was deleted and repushed:
       was 91b0bb9a43631d24ba5ce90876976521c57c95a5
       now 6c7bb0dd1efb6c5965285d60e23c407ad9d138f5

 1: 484bd6620 < --:  ------- Add option to disable escaping HTML in articles
 2: dab73f8fa < --:  ------- Updated Articles docs to include disabling escaped HTML
 3: 27238b8b2 < --:  ------- Update article postfix loops from using $_ to a named variable
 4: 0b24dae38 =  1: 92aa5d684 Add keyboard shortcuts for reply and comment
 5: 843170cdb =  2: b6b2777f9 Allow rt-setup-fulltext-index to prompt for dba password
 6: d5902aaed =  3: 0c8b88190 Fix typo in POD
 7: 3c98ed63e < --:  ------- Add AnonymizeEmail method for RT::Attachments
 8: a37f0a449 < --:  ------- Add GenerateAnonymousName function for RT::User
--:  ------- >  4: d8f98d488 Add GenerateAnonymousName function for RT::User
--:  ------- >  5: 628af98ad Create method AnonymizeUser in User.pm
 9: 2489d931a !  6: ab756f373 Create portlet for removing user information
    @@ -14,7 +14,7 @@
     +%#
     +%# COPYRIGHT:
     +%#
    -+%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
    ++%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
     +%#                                          <sales at bestpractical.com>
     +%#
     +%# (Except where explicitly superseded by other copyright notices)
    @@ -57,46 +57,35 @@
     +%# those contributions and any derivatives thereof.
     +%#
     +%# END BPS TAGGED BLOCK }}}
    -+<div class="modal" id="user-info-modal">
    -+% if ( $attachments->Count > 500 ) {
    -+    <p>
    -+    You will need to update <% $attachments->Count %> attachment records to remove <% $user->EmailAddress ? $user->EmailAddress : $user->Name %>.
    -+    please use the command line tool to avoid crashing the server.
    -+    </p>
    -+     <a href="#" rel="modal:close"><button>Ok</button></a>
    -+% } else {
    -+    <p>Are you sure you want to update <% $attachments->Count %> attachment records to remove <% $user->EmailAddress ? $user->EmailAddress : $user->Name %></p>
    -+    <a href="?id=<% $id %>&Anonymize=1"><button>Ok</button></a>
    -+    <a href="#" rel="modal:close"><button>Cancel</button></a>
    -+% }
    ++<div class="modal" id="user-info-modal" align="center">
    ++    <form name="anonymize_user_form" method="GET" action="/Admin/Users/Modify.html">
    ++        <p>Are you sure you want to anonymize user: <% $UserObj->Name %>?</p>
    ++        <p>
    ++           Check to clear user customfields:
    ++            <input name="clear_customfields" type="checkbox" class="checkbox">
    ++        </p>
    ++
    ++        <button type="submit" class="button">Ok</button>
    ++        <a href="#" rel="modal:close" class="button">Cancel</a>
    ++        <input type="hidden" name="id" value="<% $UserObj->id %>">
    ++        <input type="hidden" name="Anonymize" value=1>
    ++    </form>
     +</div>
     +<&|/Widgets/TitleBox,
     +    class => 'user-related-info',
     +    title => loc("User related info"),
     +&>
     +
    -+<div class="row">
    -+    <div class="col-md-12">
    -+        <a href="#user-info-modal" rel="modal:open"><button>Anonymize User</button></a>
    -+        <a href="/Admin/Tools/Shredder/index.html?Plugin=Users&Users%3Astatus=enabled&Users%3Aname=<% $user->Name %>&Users%3Areplace_relations=nobody&Search=Search"><button name="replace-user">Replace User Information</button></a>
    -+        <a href="/Admin/Tools/Shredder/index.html?Plugin=Users&Users%3Astatus=enabled&Users%3Aname=<% $user->Name %>&Search=Search&remove_user"><button name="remove-user">Remove User Information</button></a>
    ++<div>
    ++    <div>
    ++        <a href="#user-info-modal" rel="modal:open" class="button" name="anonymize_user">Anonymize User</a>
    ++        <a href="/Admin/Tools/Shredder/index.html?Plugin=Users&Users%3Astatus=enabled&Users%3Aname=<% $UserObj->Name %>&Users%3Areplace_relations=nobody&Search=Search" name="replace-user" class="button">Replace User Information</a>
    ++        <a href="/Admin/Tools/Shredder/index.html?Plugin=Users&Users%3Astatus=enabled&Users%3Aname=<% $UserObj->Name %>&Search=Search&remove_user" class="button" name="remove-user">Remove User Information</a>
     +    </div>
     +</div>
     +</&>
    -+<%init>
    -+my $user = RT::User->new($session{'CurrentUser'});
    -+my ($ret, $msg) = $user->Load($id);
    -+return ($ret, $msg) unless $ret;
    -+
    -+# Number of attachments that will be Anonymized
    -+my $attachments = RT::Attachments->new( $session{CurrentUser} );
    -+$attachments->Limit(FIELD => 'Content', VALUE => $user->EmailAddress, OPERATOR => 'LIKE', CASESENSITIVE => 0, ENTRYAGGREGATOR => 'OR', SUBCLAUSE => 'email');
    -+$attachments->Limit(FIELD => 'Headers', VALUE => $user->EmailAddress, OPERATOR => 'LIKE', CASESENSITIVE => 0, ENTRYAGGREGATOR => 'OR', SUBCLAUSE => 'email');
    -+$attachments->Limit(FIELD => 'Subject', VALUE => $user->EmailAddress, OPERATOR => 'LIKE', CASESENSITIVE => 0, ENTRYAGGREGATOR => 'OR', SUBCLAUSE => 'email');
    -+</%init>
     +
     +<%ARGS>
    -+$Anonymize => undef
    -+$id        => undef
    ++$UserObj   => undef
     +</%ARGS>
     
10: 447698efc !  7: ca2428c81 Add portlet to user admin modify page
    @@ -1,10 +1,6 @@
     Author: Craig Kaiser <craig at bestpractical.com>
     
    -    Add portlet for removing user info to modify page
    -    
    -    Call the mason component for the options to remove user information.
    -    Also handle if the Anonymize user option is selected in the INIT
    -    section.
    +    Add portlet to user admin 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
    @@ -13,7 +9,7 @@
      % }
      </form>
      
    -+<& /Elements/UserRelatedInfo, id => $id, Anonymize => $ARGS{Anonymize} &>
    ++<& /Elements/UserRelatedInfo, UserObj => $UserObj &>
     +
      <%INIT>
      
    @@ -22,22 +18,9 @@
          }
      }
      
    -+if ( $ARGS{Anonymize} ) {
    -+    my @attrs = keys %{ $UserObj->_CoreAccessible };
    -+
    -+    my $attachments = RT::Attachments->new( $session{CurrentUser} );
    -+    my ($ret, $msg) = $attachments->AnonymizeEmail($UserObj->EmailAddress);
    -+    return ($ret, $msg) unless $ret;
    -+
    -+    # Remove identifying user information from record
    -+    foreach my $attr (@attrs) {
    -+        my $method = 'Set' . $attr;
    -+            $UserObj->$method('');
    -+    }
    -+
    -+    my $anon_name = $UserObj->GenerateAnonymousName();
    -+    ($ret, $msg) = $UserObj->SetName($anon_name);
    -+    return ($ret, $msg) unless $ret;
    ++if ( $ARGS{'Anonymize'} ) {
    ++    my ($ret, $msg) = $UserObj->AnonymizeUser(clear_customfields => $ARGS{'clear_customfields'});
    ++    RT::Logger->error($msg) unless $ret;
     +}
     +
      # This code does automatic redirection if any updates happen.
11: beb905a26 < --:  ------- Check that user information is anonymized
12: 91b0bb9a4 < --:  ------- Add test for replace user information
--:  ------- >  8: 66e7a8792 Create test for remove user information
--:  ------- >  9: 6c7bb0dd1 Add test for clearing customfields with anonymize user action



More information about the rt-commit mailing list