[Rt-commit] rt branch, 4.4/remove-user-info, repushed
Craig Kaiser
craig at bestpractical.com
Fri Dec 21 18:21:55 EST 2018
The branch 4.4/remove-user-info was deleted and repushed:
was b58a4ff577f5cb9d7d86c13b9f5ce38dd774da9c
now b0b94f3b19d599a148e0b331e11033cd75aea81c
--: ------- > 1: d0449e83dd Create ReplaceAttachments, ReplaceHeader and ReplaceContent Methods
--: ------- > 2: 74736c6cbd Create rt-munge-attachments executable
--: ------- > 3: 1461de1fec Add tests for methods that munge the attachments table
--: ------- > 4: 32518488be Fix rt-dump-metadata for the AppliedTo => AddedTo change
--: ------- > 5: 55f253644b Rename RelatedData to BasicUserData
1: 9df047a66f ! 6: 7c348191a6 Move User related info portlet into side column
@@ -10,9 +10,9 @@
<& /Elements/EditCustomFields, Object => $UserObj, Grouping => 'Access control' &>
+</&>
++<&| /Widgets/TitleBox, title => loc('Comments about this user'), class => 'user-info-comments' &>
+<table width="100%" border="0">
+ <tr><td valign="top" class="boxcontainer">
-+ <&| /Widgets/TitleBox, title => loc('Comments about this user'), class => 'user-info-comments' &>
+ <textarea class="comments" name="Comments" cols="80" rows="5" wrap="virtual"><%$UserObj->Comments//$ARGS{Comments}//''%></textarea>
+ </td></tr>
+</table>
@@ -54,10 +54,15 @@
</form>
-<& /User/Elements/RelatedData,
-+<& /User/Elements/BasicUserData,
- UserObj => $UserObj,
- UserDataButton => loc( 'Download My Data' ),
- UserTicketsButton => loc( 'Download My Tickets' ),
+- UserObj => $UserObj,
+- UserDataButton => loc( 'Download My Data' ),
+- UserTicketsButton => loc( 'Download My Tickets' ),
+- UserTxnButton => loc( 'Download My Transaction Data' ),
+-&>
+-
+ <%INIT>
+
+ my $UserObj = RT::User->new( $session{'CurrentUser'} );
diff --git a/share/html/SelfService/Prefs.html b/share/html/SelfService/Prefs.html
--- a/share/html/SelfService/Prefs.html
@@ -99,37 +104,169 @@
+$m->comp('/User/BasicUserData.tsv', %ARGS);
</%INIT>
-diff --git a/share/html/User/RelatedData.tsv b/share/html/User/BasicUserData.tsv
-similarity index 100%
-rename from share/html/User/RelatedData.tsv
-rename to share/html/User/BasicUserData.tsv
-
-diff --git a/share/html/User/Elements/RelatedData b/share/html/User/Elements/BasicUserData
-similarity index 88%
-rename from share/html/User/Elements/RelatedData
-rename to share/html/User/Elements/BasicUserData
+diff --git a/share/html/User/Elements/RelatedData b/share/html/User/Elements/RelatedData
+deleted file mode 100644
--- a/share/html/User/Elements/RelatedData
-+++ b/share/html/User/Elements/BasicUserData
-@@
- title => loc("User related info"),
- &>
-
++++ /dev/null
+@@
+-%# BEGIN BPS TAGGED BLOCK {{{
+-%#
+-%# COPYRIGHT:
+-%#
+-%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+-%# <sales at bestpractical.com>
+-%#
+-%# (Except where explicitly superseded by other copyright notices)
+-%#
+-%#
+-%# LICENSE:
+-%#
+-%# This work is made available to you under the terms of Version 2 of
+-%# the GNU General Public License. A copy of that license should have
+-%# been provided with this software, but in any event can be snarfed
+-%# from www.gnu.org.
+-%#
+-%# This work is distributed in the hope that it will be useful, but
+-%# WITHOUT ANY WARRANTY; without even the implied warranty of
+-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-%# General Public License for more details.
+-%#
+-%# You should have received a copy of the GNU General Public License
+-%# along with this program; if not, write to the Free Software
+-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+-%# 02110-1301 or visit their web page on the internet at
+-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+-%#
+-%#
+-%# CONTRIBUTION SUBMISSION POLICY:
+-%#
+-%# (The following paragraph is not intended to limit the rights granted
+-%# to you to modify and distribute this software under the terms of
+-%# the GNU General Public License and is only of importance to you if
+-%# you choose to contribute your changes and enhancements to the
+-%# community by submitting them to Best Practical Solutions, LLC.)
+-%#
+-%# By intentionally submitting any modifications, corrections or
+-%# derivatives to this work, or any other work intended for use with
+-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+-%# you are the copyright holder for those contributions and you grant
+-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+-%# royalty-free, perpetual, license to use, copy, create derivative
+-%# works based on those contributions, and sublicense and distribute
+-%# those contributions and any derivatives thereof.
+-%#
+-%# END BPS TAGGED BLOCK }}}
+-<&|/Widgets/TitleBox,
+- class => 'user-related-info',
+- title => loc("User related info"),
+-&>
+-
-<div>
- <a href="/User/RelatedData.tsv?Type=User&id=<% $UserObj->id %>" class="button"><% $UserDataButton %></a>
-+<table>
-+ <tr><td>
-+ <a href="/User/BasicUserData.tsv?Type=User&id=<% $UserObj->id %>" class="button"><% $UserDataButton %></a>
-+ </td></tr>
-+ <tr><td>
- <a href="/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>" class="button"><% $UserTicketsButton %></a>
+- <a href="/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>" class="button"><% $UserTicketsButton %></a>
- <a href="/User/RelatedData.tsv?Type=Transaction&id=<% $UserObj->id %>" class="button"><% $UserTxnButton %></a>
-</div>
-+ </td></tr>
-+ <tr><td>
-+ <a href="/User/BasicUserData.tsv?Type=Transaction&id=<% $UserObj->id %>" class="button"><% $UserTxnButton %></a>
-+ </td></tr>
-+</table>
- </&>
-
- <%INIT>
-
+-</&>
+-
+-<%INIT>
+-my $Format = RT->Config->Get('UserTicketDataResultFormat') || RT->Config->Get('DefaultSearchResultFormat');
+-</%INIT>
+-
+-<%ARGS>
+-$UserObj
+-$UserDataButton => loc( 'Download User Data' )
+-$UserTicketsButton => loc( 'Download User Tickets' )
+-$UserTxnButton => loc( 'Download User Transaction Data' )
+-</%ARGS>
+
+diff --git a/share/html/User/RelatedData.tsv b/share/html/User/RelatedData.tsv
+deleted file mode 100644
+--- a/share/html/User/RelatedData.tsv
++++ /dev/null
+@@
+-%# BEGIN BPS TAGGED BLOCK {{{
+-%#
+-%# COPYRIGHT:
+-%#
+-%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+-%# <sales at bestpractical.com>
+-%#
+-%# (Except where explicitly superseded by other copyright notices)
+-%#
+-%#
+-%# LICENSE:
+-%#
+-%# This work is made available to you under the terms of Version 2 of
+-%# the GNU General Public License. A copy of that license should have
+-%# been provided with this software, but in any event can be snarfed
+-%# from www.gnu.org.
+-%#
+-%# This work is distributed in the hope that it will be useful, but
+-%# WITHOUT ANY WARRANTY; without even the implied warranty of
+-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-%# General Public License for more details.
+-%#
+-%# You should have received a copy of the GNU General Public License
+-%# along with this program; if not, write to the Free Software
+-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+-%# 02110-1301 or visit their web page on the internet at
+-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+-%#
+-%#
+-%# CONTRIBUTION SUBMISSION POLICY:
+-%#
+-%# (The following paragraph is not intended to limit the rights granted
+-%# to you to modify and distribute this software under the terms of
+-%# the GNU General Public License and is only of importance to you if
+-%# you choose to contribute your changes and enhancements to the
+-%# community by submitting them to Best Practical Solutions, LLC.)
+-%#
+-%# By intentionally submitting any modifications, corrections or
+-%# derivatives to this work, or any other work intended for use with
+-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+-%# you are the copyright holder for those contributions and you grant
+-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+-%# royalty-free, perpetual, license to use, copy, create derivative
+-%# works based on those contributions, and sublicense and distribute
+-%# those contributions and any derivatives thereof.
+-%#
+-%# END BPS TAGGED BLOCK }}}
+-<%ARGS>
+-$PreserveNewLines => 0
+-$Type => 'User'
+-$Format => undef
+-$id
+-</%ARGS>
+-
+-<%INIT>
+-# Abort unless supported type for export found
+-Abort('Incorrect value passed for Type') unless
+- $Type && ( $Type eq 'User' || $Type eq 'Transaction');
+-
+-if ( $session{'CurrentUser'}->id ne $id ) {
+- Abort('User does not have the right to view other users') unless
+- $session{'CurrentUser'}->UserObj->HasRight( Object => $RT::System, Right =>'AdminUsers');
+-}
+-
+-my $Collection;
+-
+-if ( $Type eq 'User' ) {
+- $Format = RT->Config->Get('UserDataResultFormat') unless $Format;
+-
+- $Collection = RT::Users->new( $session{'CurrentUser'} );
+- $Collection->Limit( FIELD => 'id', VALUE => $id );
+-
+-} elsif ( $Type eq 'Transaction' ) {
+- $Format = RT->Config->Get('UserTransactionDataResultFormat') unless $Format;
+-
+- $Collection = RT::Transactions->new( $session{'CurrentUser'} );
+- $Collection->Limit( FIELD => 'ObjectType', VALUE => 'RT::Ticket' );
+- $Collection->Limit( FIELD => 'Creator', VALUE => $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 );
+-</%INIT>
+
2: 2fbff4077b ! 7: b703716939 Create method AnonymizeUser in User.pm
@@ -24,15 +24,15 @@
+ my $self = shift;
+ my $length = shift;
+
-+ my $invalid = 1;
-+ my $name = '';
++ my $valid = 0;
++ my $name = '';
+
-+ while ( $invalid ) {
++ while ( not $valid ) {
+ my @Chars = ('a'..'z', 'A'..'Z', '0'..'9');
+ for (1..$length || 9) {
+ $name .= $Chars[int rand @Chars];
+ }
-+ $invalid = !$self->ValidateName('anon_' . $name);
++ $valid = $self->ValidateName('anon_' . $name);
+ }
+ return 'anon_' . $name;
+}
@@ -53,50 +53,52 @@
+ @_,
+ );
+
-+ my @user_idenifying_info = qw (
-+ Address1 Address2 City Comments Country EmailAddress
-+ FreeformContactInfo Gecos HomePhone MobilePhone NickName Organization
-+ PagerPhone RealName Signature SMIMECertificate State Timezone WorkPhone Zip
-+ );
++ my @core_accessable = $self->_CoreAccessible();
++ my @tmp;
++ map{ push @tmp, $_ if $self->_Accessible($_, 'write') } keys %{$core_accessable[0] };
++
++ my %skip_clear = ( Name => '1', Password => '1', AuthToken => '1' );
++ my @user_identifying_info = grep { $skip_clear{$_} ? 0 : 1 } @tmp;
+
+ $RT::Handle->BeginTransaction();
+ # Remove identifying user information from record
-+ foreach my $attr (@user_idenifying_info) {
++ foreach my $attr (@user_identifying_info) {
+ if ( defined $self->$attr && length $self->$attr) {
+ my $method = 'Set' . $attr;
+ my ($ret, $msg) = $self->$method('');
-+ RT::Logger->error($msg) unless $ret;
-+ return ($ret, $msg) unless $ret;
++ RT::Logger->error("Failed to clear user value for: $attr ".$msg) unless $ret;
++ $RT::Handle->Rollback() unless $ret;
++ return ($ret, "Failed to clear user value for: $attr " . $msg) unless $ret;
+ }
+ }
+
+ # Do not do anything if password is already unset
+ if ( $self->HasPassword ) {
+ my ($ret, $msg) = $self->_Set(Field => 'Password', Value => '*NO-PASSWORD*' );
-+ RT::Logger->error($msg) unless $ret;
++ RT::Logger->error("Failed to set password to '*NO-PASSWORD*' ".$msg) unless $ret;
+ }
+
+ # Generate the random anon username
+ my ($ret, $msg) = $self->SetName($self->GenerateAnonymousName);
-+ RT::Logger->error($msg) unless $ret;
++ RT::Logger->error("Failed to set name to generaterated anonymous name".$msg) unless $ret;
+
+ # Remove user customfield values
+ if ( $args{'ClearCustomFields'} ) {
+ my $customfields = RT::CustomFields->new(RT->SystemUser);
-+ ($ret, $msg) = $customfields->LimitToLookupType('RT::User');
-+ RT::Logger->error($msg) unless $ret;
++ $customfields->LimitToLookupType('RT::User');
+
+ while (my $customfield = $customfields->Next) {
-+ if ( $self->FirstCustomFieldValue( $customfield->Name ) ) {
++ while ( $self->FirstCustomFieldValue( $customfield->Name ) ) {
+ ($ret, $msg) = $self->DeleteCustomFieldValue( Field => $customfield->Id, Value => $self->FirstCustomFieldValue( $customfield->Name ) );
+ RT::Logger->error($msg) unless $ret;
+ $RT::Handle->Rollback() unless $ret;
++ return ($ret, "Failed to delete custom field value " . $msg) unless $ret;
+ }
+ }
+ }
+ $RT::Handle->Commit();
+
-+ return(1, 'User successfully anonymized');
++ return(1, $self->loc('User successfully anonymized'));
+}
+
=head2 ValidatePassword STRING
8: fb62de5abd ! 8: 45571ce765 Add Timezone to user column map
@@ -1,6 +1,6 @@
Author: Craig Kaiser <craig at bestpractical.com>
- Update download user data default format
+ Add Timezone to user column map
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
--- a/etc/RT_Config.pm.in
@@ -14,13 +14,20 @@
=item C<$UserTransactionDataResultFormat>
+
+diff --git a/share/html/Elements/RT__User/ColumnMap b/share/html/Elements/RT__User/ColumnMap
+--- a/share/html/Elements/RT__User/ColumnMap
++++ b/share/html/Elements/RT__User/ColumnMap
@@
+ title => 'Status', # loc
+ value => sub { return $_[0]->Disabled? $_[0]->loc('Disabled'): $_[0]->loc('Enabled') },
+ },
++ Timezone => {
++ title => 'Timezone', # loc
++ attribute => 'Timezone',
++ value => sub { return $_[0]->Timezone },
++ },
+ };
- =cut
-
--Set($UserTransactionDataResultFormat, "'__ObjectId__', '__id__', '__Created__', '__Description__',\
-+Set($UserTransactionDataResultFormat, "'__ObjectIdTicketTitle__', '__id__', '__Created__', '__Description__',\
- '__OldValue__', '__NewValue__', '__Content__'");
-
-
+ </%ONCE>
--: ------- > 9: d5c949bd9e Update download user data default format
3: b5bd61f463 = 10: feb6fc4c5a Create modal mason component
9: beb8682691 ! 11: c21aa2379a Create portlet for removing user information
@@ -12,20 +12,12 @@
--- a/share/html/User/BasicUserData.tsv
+++ b/share/html/User/BasicUserData.tsv
@@
- $Type => 'User'
- $Format => undef
- $id
-+$Filename => undef
- </%ARGS>
-
- <%INIT>
-@@
$Collection->Limit( FIELD => 'Type', VALUE => 'Comment' );
}
-$m->comp( "/Elements/TSVExport", Collection => $Collection, Format => $Format, PreserveNewLines => $PreserveNewLines );
+$m->comp( "/Elements/TSVExport", Collection => $Collection, Format => $Format,
-+ PreserveNewLines => $PreserveNewLines, Filename => $Filename,
++ PreserveNewLines => $PreserveNewLines
+);
</%INIT>
@@ -54,9 +46,9 @@
+<div id="manage-user-data">
+ <div name="download-user-data-title"><b>Download User Information:</b></div>
+ <div name="download-user-data-buttons" class="inline-row">
-+ <div class="inline-cell"><a class="button" href="/User/BasicUserData.tsv?Type=User&id=<% $UserObj->id %>&Filename=UserData.tsv"><% $UserDataButton %></a></div>
-+ <div class="inline-cell"><a class="button" href="/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>&Filename=UserTicketData.tsv"><% $UserTicketsButton %></a></div>
-+ <div class="inline-cell"><a class="button" href="/User/BasicUserData.tsv?Type=Transaction&id=<% $UserObj->id %>&Filename=UserTransactionData.tsv"><% $UserTxnButton %></a></div>
++ <div class="inline-cell"><a class="button" href="/User/BasicUserData.tsv?Type=User&id=<% $UserObj->id %>"><% $UserDataButton %></a></div>
++ <div class="inline-cell"><a class="button" href="/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>"><% $UserTicketsButton %></a></div>
++ <div class="inline-cell"><a class="button" href="/User/BasicUserData.tsv?Type=Transaction&id=<% $UserObj->id %>"><% $UserTxnButton %></a></div>
+ </div>
+ <div name="remove-user-data-title"><b>Remove User Information:</b></div>
+ <div name="remove-user-data-buttons" class="inline-row">
4: d179f12923 ! 12: 2fa200701b Allow TSVExport filename to be set through Filename arg
@@ -22,3 +22,40 @@
my $DisplayFormat = $m->comp('/Elements/ScrubHTML', Content => $Format);
+diff --git a/share/html/User/BasicUserData.tsv b/share/html/User/BasicUserData.tsv
+--- a/share/html/User/BasicUserData.tsv
++++ b/share/html/User/BasicUserData.tsv
+@@
+ $Type => 'User'
+ $Format => undef
+ $id
++$Filename => undef
+ </%ARGS>
+
+ <%INIT>
+@@
+ }
+
+ $m->comp( "/Elements/TSVExport", Collection => $Collection, Format => $Format,
+- PreserveNewLines => $PreserveNewLines
++ PreserveNewLines => $PreserveNewLines, Filename => $Filename,
+ );
+ </%INIT>
+
+diff --git a/share/html/User/Elements/BasicUserData b/share/html/User/Elements/BasicUserData
+--- a/share/html/User/Elements/BasicUserData
++++ b/share/html/User/Elements/BasicUserData
+@@
+ <div id="manage-user-data">
+ <div name="download-user-data-title"><b>Download User Information:</b></div>
+ <div name="download-user-data-buttons" class="inline-row">
+- <div class="inline-cell"><a class="button" href="/User/BasicUserData.tsv?Type=User&id=<% $UserObj->id %>"><% $UserDataButton %></a></div>
+- <div class="inline-cell"><a class="button" href="/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>"><% $UserTicketsButton %></a></div>
+- <div class="inline-cell"><a class="button" href="/User/BasicUserData.tsv?Type=Transaction&id=<% $UserObj->id %>"><% $UserTxnButton %></a></div>
++ <div class="inline-cell"><a class="button" href="/User/BasicUserData.tsv?Type=User&id=<% $UserObj->id %>&Filename=UserData.tsv"><% $UserDataButton %></a></div>
++ <div class="inline-cell"><a class="button" href="/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>&Filename=UserTicketData.tsv"><% $UserTicketsButton %></a></div>
++ <div class="inline-cell"><a class="button" href="/User/BasicUserData.tsv?Type=Transaction&id=<% $UserObj->id %>&Filename=UserTransactionData.tsv"><% $UserTxnButton %></a></div>
+ </div>
+ <div name="remove-user-data-title"><b>Remove User Information:</b></div>
+ <div name="remove-user-data-buttons" class="inline-row">
+
5: 6707c18358 < --: ------- Add Timezone to user column map
6: e3228e2631 < --: ------- Set TSV column header based on column maps
7: 8837269fb3 < --: ------- Add column map for ObjectIdTicketTitle
10: b84bbe7b81 ! 13: 932a9c87ca Add remove user info portlet to user modify page
@@ -6,16 +6,26 @@
--- a/share/html/Admin/Users/Modify.html
+++ b/share/html/Admin/Users/Modify.html
@@
+
+ </table>
+ </&>
++% if ( !$Create ) {
+ <& /User/Elements/BasicUserData, UserObj => $UserObj &>
++% }
+ <br />
+
+ <& /Elements/EditCustomFieldCustomGroupings, Object => $UserObj &>
+@@
% }
</form>
+% if ( $UserObj->Id ) {
+ <& /Elements/Modal, ModalId => "user-info-modal", Method => 'POST', Action => RT->Config->Get('WebPath') . '/Admin/Users/Modify.html', Fields => [
-+ { Label => "Are you sure you want to anonymize user: ". $UserObj->Name . "?" },
++ { Label => loc("Are you sure you want to anonymize user") . ": " . $UserObj->Name . "?" },
+ { Input => 'Hidden', Value => $UserObj->Id, Name => 'id' },
+ { Input => 'Hidden', Value => 1, Name => 'Anonymize' },
+ {
-+ Label => "Check to clear user customfields:",
++ Label => loc("Check to clear user custom fields") . ":",
+ Input => 'checkbox',
+ Class => 'checkbox',
+ Name => 'clear_customfields',
11: 259976947f ! 14: ba60244552 Create test for remove user information
@@ -24,8 +24,11 @@
+
+# Anonymize User
+{
-+ my $user = RT::Test->load_or_create_user( Name => 'Test User' );
-+ ok $user && $user->id;
++ my $user = RT::Test->load_or_create_user(
++ Name => 'Test User',
++ EmailAddress => 'test at example.com',
++ );
++ ok( $user && $user->id );
+
+ my $user_id = $user->id;
+
@@ -36,23 +39,25 @@
+ "Anonymize user" );
+
+ $user->Load($user_id);
-+ is $user->EmailAddress, '', 'User Email removed';
++ is( $user->EmailAddress, '', 'User Email removed' );
+
-+# UserId is still the same, but all other records should be anonimyzed for TestUser
++ # UserId is still the same, but all other records should be anonimyzed for TestUser
+ my ( $ret, $msg ) = $user->Load($user_id);
-+ ok $ret;
++ ok($ret);
+
-+ is $user->Name =~ /anon_/, 1, 'Username replaced with anon name';
++ is( $user->Name =~ /anon_/, 1, 'Username replaced with anon name' );
+
-+ my @user_idenifying_info = qw (
-+ Address1 Address2 City Comments Country EmailAddress
-+ FreeformContactInfo Gecos HomePhone MobilePhone NickName Organization
-+ PagerPhone RealName Signature SMIMECertificate State Timezone WorkPhone Zip
-+ );
++ my @core_accessable = $user->_CoreAccessible();
++ my @tmp;
++ map{ push @tmp, $_ if $user->_Accessible($_, 'write') } keys %{$core_accessable[0] };
++
++ my %skip_clear = ( Name => '1', Password => '1', AuthToken => '1' );
++ my @user_identifying_info = grep { $skip_clear{$_} ? 0 : 1 } @tmp;
++
+ $user->Load($user_id);
+
+ # Ensure that all other user fields are blank
-+ foreach my $attr (@user_idenifying_info) {
++ foreach my $attr (@user_identifying_info) {
+ my $check = grep { not defined $_ or $_ eq '' or $_ eq 0 } $user->$attr;
+ is $check, 1, 'Attribute ' . $attr . ' is blank';
+ }
@@ -64,7 +69,7 @@
+ LookupType => 'RT::User',
+ Type => 'FreeformSingle',
+ );
-+ ok $ret, $msg;
++ ok( $ret, $msg );
+
+ ( $ret, $msg ) = $customfield->AddToObject($user);
+ ok( $ret, "Added CF to user object - " . $msg );
@@ -73,10 +78,10 @@
+ Field => 'TestCustomfield',
+ Value => 'Testing'
+ );
-+ ok $ret, $msg;
++ ok( $ret, $msg );
+
-+ is $user->FirstCustomFieldValue('TestCustomfield'), 'Testing',
-+ 'Customfield exists and has value for user.';
++ is( $user->FirstCustomFieldValue('TestCustomfield'), 'Testing',
++ 'Customfield exists and has value for user.' );
+
+ $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $user->id );
+ $agent->follow_link_ok( { text => 'Anonymize User' } );
@@ -88,8 +93,8 @@
+ "Anonymize user and customfields"
+ );
+
-+ is $user->FirstCustomFieldValue('TestCustomfield'), undef,
-+ 'Customfield value cleared';
++ is( $user->FirstCustomFieldValue('TestCustomfield'), undef,
++ 'Customfield value cleared' );
+}
+
+# Test replace user
@@ -99,7 +104,8 @@
+ Password => 'password',
+ Privileged => 1
+ );
-+ ok $user && $user->id;
++ ok( $user && $user->id );
++ my $id = $user->id;
+
+ ok( RT::Test->set_rights(
+ { Principal => $user, Right => [qw(SuperUser)] },
@@ -107,8 +113,8 @@
+ 'set rights'
+ );
+
-+ ok $agent->logout;
-+ ok $agent->login( 'root' => 'password' );
++ ok( $agent->logout );
++ ok( $agent->login( 'root' => 'password' ) );
+
+ $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $user->id );
+ $agent->follow_link_ok( { text => 'Replace User' } );
@@ -121,10 +127,10 @@
+ "Replace user"
+ );
+
-+ my ($ret, $msg) = $user->Load($user->Id);
++ my ($ret, $msg) = $user->Load($id);
+
-+ is $ret, 0,
-+ 'User successfully deleted with replace';
++ is( $ret, 0,
++ 'User successfully deleted with replace' );
+}
+
+# Test Remove user
@@ -134,7 +140,8 @@
+ Password => 'password',
+ Privileged => 1
+ );
-+ ok $user && $user->id;
++ ok( $user && $user->id );
++ my $id = $user->Id;
+
+ ok( RT::Test->set_rights(
+ { Principal => $user, Right => [qw(SuperUser)] },
@@ -156,10 +163,10 @@
+ "Remove user"
+ );
+
-+ my ($ret, $msg) = $user->Load($user->Id);
++ my ($ret, $msg) = $user->Load($id);
+
-+ is $ret, 0,
-+ 'User successfully deleted with remove';
++ is( $ret, 0,
++ 'User successfully deleted with remove' );
+}
+
+done_testing();
12: 20157bf6c0 ! 15: b0b94f3b19 Update download user info tests
@@ -18,7 +18,7 @@
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
-+id\tName\tEmail Address\tReal Name\tNickname\tOrganization\tHome Phone\tWork Phone\tMobile Phone\tPager Phone\tAddress\tAddress 2\tCity\tState\tZip\tCountry\tUnix login\tLanguage\tTimezone\tFreeFormContactInfo
++id\tName\tEmailAddress\tRealName\tNickName\tOrganization\tHomePhone\tWorkPhone\tMobilePhone\tPagerPhone\tAddress1\tAddress2\tCity\tState\tZip\tCountry\tGecos\tLang\tTimezone\tFreeFormContactInfo
+14\troot\troot\@localhost\tEnoch Root\t\t\t\t\t\t\t\t\t\t\t\t\troot\t\t\t
EOF
@@ -32,7 +32,7 @@
my $transaction_info_tsv = <<EOF;
-ObjectId\tid\tCreated\tDescription\tOldValue\tNewValue\tContent
-+Ticket Id\tid\tCreated\tDescription\tOld Value\tNew Value\tContent
++Ticket Id\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
@@ -44,9 +44,4 @@
+ $agent->follow_link_ok( { text => 'User Tickets' } );
my $ticket_info_tsv = <<EOF;
--id\tSubject\tStatus\tQueueName\tOwner\tPriority\tRequestors
-+id\tSubject\tStatus\tQueue\tOwner\tPriority\tRequestor
- 1\tTest\topen\tGeneral\tNobody in particular\t0\troot (Enoch Root)
- EOF
-
-
+ id\tSubject\tStatus\tQueueName\tOwner\tPriority\tRequestors
13: b58a4ff577 < --: ------- Remove BasicUserData from Prefs/AboutMe page.
More information about the rt-commit
mailing list