[Rt-commit] rt branch, 4.2/skip-system-user-in-txns-right-check, created. rt-4.2.10-191-gc6db347

? sunnavy sunnavy at bestpractical.com
Sun Mar 15 08:09:39 EDT 2015


The branch, 4.2/skip-system-user-in-txns-right-check has been created
        at  c6db3473609f7c5989d20d3ba6a5f8e21c088499 (commit)

- Log -----------------------------------------------------------------
commit c6db3473609f7c5989d20d3ba6a5f8e21c088499
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Mar 15 19:57:02 2015 +0800

    pass directly for system user in RT::Transaction->CurrentUserCanSee check
    
    this is because outdated ObjectType field could cause the following ->Object to
    die. since the _outdated_ issue usually happens when upgrading RT, we need to
    short-circuit it for system user to make upgrade code happy.
    
    one fail case is in etc/upgrade/upgrade-articles, where we iterate transactions
    to update ObjectType from "RT::FM::Article" to "RT::Article". the error is:
    Can't locate object method "new" via package "RT::FM::Article"

diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index 79043ce..d909171 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -1357,11 +1357,15 @@ This fact depends on type of the transaction, type of an object the transaction
 is attached to and may be other conditions, so this method is prefered over
 custom implementations.
 
+It always returns true if current user is system user.
+
 =cut
 
 sub CurrentUserCanSee {
     my $self = shift;
 
+    return 1 if $self->CurrentUser->PrincipalObj->Id == RT->SystemUser->Id;
+
     # Make sure the user can see the custom field before showing that it changed
     my $type = $self->__Value('Type');
     if ( $type eq 'CustomField' and my $cf_id = $self->__Value('Field') ) {

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


More information about the rt-commit mailing list