[Rt-commit] r3293 - in rt/branches/3.4-RELEASE: . bin lib/RT lib/RT/Interface lib/t/regression

jesse at bestpractical.com jesse at bestpractical.com
Sun Jul 3 16:14:30 EDT 2005


Author: jesse
Date: Sun Jul  3 16:14:29 2005
New Revision: 3293

Modified:
   rt/branches/3.4-RELEASE/   (props changed)
   rt/branches/3.4-RELEASE/bin/rt-mailgate.in
   rt/branches/3.4-RELEASE/lib/RT/CustomField_Overlay.pm
   rt/branches/3.4-RELEASE/lib/RT/Interface/Email.pm
   rt/branches/3.4-RELEASE/lib/RT/Record.pm
   rt/branches/3.4-RELEASE/lib/t/regression/06mailgateway.t
Log:
 r22091 at hualien:  jesse | 2005-07-03 16:13:10 -0400
  * Disabling a new feature that might be dangerous; test fixes; cf fixes


Modified: rt/branches/3.4-RELEASE/bin/rt-mailgate.in
==============================================================================
--- rt/branches/3.4-RELEASE/bin/rt-mailgate.in	(original)
+++ rt/branches/3.4-RELEASE/bin/rt-mailgate.in	Sun Jul  3 16:14:29 2005
@@ -172,11 +172,14 @@
 =item C<--action>
 
 Specifies what happens to email sent to this alias.  The avaliable
-basic actions are: C<correspond>, C<comment>, C<take> and C<resolve>.
-You can execute two or more actions on a single message using a C<->
-separated list.  RT will execute the actions in the listed order.
-For example you can use C<take-comment>, C<correspond-resolve> or
-C<take-comment-resolve> as actions.
+basic actions are: C<correspond>, C<comment>.
+
+
+If you've set the RT configuration variable B<$RT::UnsafeEmailCommands>,
+C<take> and C<resolve> are also available.  You can execute two or more
+actions on a single message using a C<-> separated list.  RT will execute
+the actions in the listed order.  For example you can use C<take-comment>,
+C<correspond-resolve> or C<take-comment-resolve> as actions.
 
 Note that C<take> and C<resolve> actions ignore message text if used
 alone.  Include a  C<comment> or C<correspond> action if you want RT

Modified: rt/branches/3.4-RELEASE/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/CustomField_Overlay.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/CustomField_Overlay.pm	Sun Jul  3 16:14:29 2005
@@ -286,7 +286,7 @@
     # We only want one entry.
     $CFs->RowsPerPage(1);
     unless ($CFs->First) {
-        return(0, $self->loc('Custom field not found'));
+        return(0);
     }
     return($self->Load($CFs->First->id));
 

Modified: rt/branches/3.4-RELEASE/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Interface/Email.pm	Sun Jul  3 16:14:29 2005
@@ -807,7 +807,7 @@
                 return ( 0, "Message not recorded", $Ticket );
             }
         }
-        elsif ( $action =~ /^take$/i ) {
+        elsif ($RT::UnsafeEmailCommands && $action =~ /^take$/i ) {
             my ( $status, $msg ) = $Ticket->SetOwner( $CurrentUser->id );
             unless ($status) {
     
@@ -821,7 +821,7 @@
                 return ( 0, "Ticket not taken", $Ticket );
             }
         }
-        elsif ( $action =~ /^resolve$/i ) {
+        elsif ( $RT::UnsafeEmailCommands && $action =~ /^resolve$/i ) {
             my ( $status, $msg ) = $Ticket->SetStatus( 'resolved' );
             unless ($status) {
                 #Warn the sender that we couldn't actually submit the comment.

Modified: rt/branches/3.4-RELEASE/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Record.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Record.pm	Sun Jul  3 16:14:29 2005
@@ -1806,13 +1806,21 @@
     my $self  = shift;
     my $field = shift;
 
-    my $cf = $self->LoadCustomFieldByIdentifier($field);
+    if ($field) {
+        my $cf = $self->LoadCustomFieldByIdentifier($field);
 
-    unless ( $cf->Id ) {
-        return ( 0, $self->loc( "Custom field [_1] not found", $args{'Field'} ) );
+        # we were asked to search on a custom field we couldn't fine
+        unless ( $cf->id ) {
+            return RT::ObjectCustomFieldValues->new( $self->CurrentUser );
+        }
+        return ( $cf->ValuesForObject($self) );
     }
-    
-    return($cf->ValuesForObject($self));
+
+    # we're not limiting to a specific custom field;
+    my $ocfs = RT::ObjectCustomFieldValues->new( $self->CurrentUser );
+    $ocfs->LimitToObject($self);
+    return $ocfs;
+
 }
 
 =head2 CustomField IDENTIFER

Modified: rt/branches/3.4-RELEASE/lib/t/regression/06mailgateway.t
==============================================================================
--- rt/branches/3.4-RELEASE/lib/t/regression/06mailgateway.t	(original)
+++ rt/branches/3.4-RELEASE/lib/t/regression/06mailgateway.t	Sun Jul  3 16:14:29 2005
@@ -52,7 +52,7 @@
 =cut
 
 use strict;
-use Test::More tests => 77;
+use Test::More tests => 57;
 use RT;
 RT::LoadConfig();
 RT::Init();
@@ -420,6 +420,10 @@
 ($val,$msg) = $g->PrincipalObj->RevokeRight(Right => 'CreateTicket');
 ok ($val, $msg);
 
+=for later
+
+TODO: {
+
 # {{{ Check take and resolve actions
 
 # create ticket that is owned by nobody
@@ -452,6 +456,8 @@
 is( $tick->Owner, $RT::Nobody->Id, 'set owner back to nobody');
 
 
+
+    local $TODO = "Advanced mailgate actions require an unsafe configuration";
 ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action take-correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
 From: root\@localhost
@@ -489,6 +495,10 @@
 is( $tick->Status, 'resolved', 'successfuly resolved ticket via email');
 is( $tick->Transactions->Count, 7, 'no superfluous transactions');
 
+};
+
+=cut
+
 # }}}
 
 1;


More information about the Rt-commit mailing list