[Rt-commit] rt branch, 4.2/customfield-visibility-on-create, created. rt-4.2.8-24-gab7ea15

Kevin Falcone falcone at bestpractical.com
Wed Oct 22 11:29:34 EDT 2014


The branch, 4.2/customfield-visibility-on-create has been created
        at  ab7ea157603fe383d53a0ed3bc723591957fc7de (commit)

- Log -----------------------------------------------------------------
commit ab7ea157603fe383d53a0ed3bc723591957fc7de
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Oct 21 18:04:08 2014 -0400

    Don't assume the CurrentUser can see a CustomField passed to Create
    
    In e092e23 we started checking LookupType during Ticket creation to
    avoid trying to add Transaction CFs to the Ticket (and vice versa).
    Unfortunately, this assumed that the CurrentUser could Load and see the
    custom fields passed to Create.
    
    It was helpful to be able to set a default CF on create that a user
    can't change later (meaning they weren't given ModifyCustomField or
    SeeCustomField).  In particular, RTIR uses this to set Constituencies
    during email and web UI creation.  This causes ticket creation to fail
    if an Unprivileged user sends mail to an RTIR instance using
    Constituencies.
    
    Walk around the ACL since all we really want to do is parse the
    LookupType for the Custom Field to make sure we're firing on the correct
    Type of CFs.

diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 50a2ba1..f9ebaef 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -472,7 +472,7 @@ sub Create {
         next unless $arg =~ /^CustomField-(\d+)$/i;
         my $cfid = $1;
         my $cf = $self->LoadCustomFieldByIdentifier($cfid);
-        next unless $cf->ObjectTypeFromLookupType->isa(ref $self);
+        next unless $cf->ObjectTypeFromLookupType($cf->__Value('LookupType'))->isa(ref $self);
 
         foreach my $value (
             UNIVERSAL::isa( $args{$arg} => 'ARRAY' ) ? @{ $args{$arg} } : ( $args{$arg} ) )
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index b1b00a0..0e8e164 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -1428,7 +1428,7 @@ sub UpdateCustomFields {
         my $cfid   = $1;
         my $values = $args->{$arg};
         my $cf = $self->LoadCustomFieldByIdentifier($cfid);
-        next unless $cf->ObjectTypeFromLookupType->isa(ref $self);
+        next unless $cf->ObjectTypeFromLookupType($cf->__Value('LookupType'))->isa(ref $self);
         foreach
           my $value ( UNIVERSAL::isa( $values, 'ARRAY' ) ? @$values : $values )
         {

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


More information about the rt-commit mailing list