Commit c1565ef1 authored by Alex Vandiver's avatar Alex Vandiver
Browse files

Remove 3.6 install notes and patches; fold INSTALL into POD

parent 216c0f0f
INSTALLATION
To install this module, run the following commands:
perl Makefile.PL
make
make install
PATCH
If you are using RT 3.6.0 or earlier, you MUST apply a patch in order to use
this extension.
Patch(es) are in patch directory. Apply patch with following commands:
cd /opt/rt3
patch -p0 <path/to/patch/command_by_mail-<patch version>-RT-<rt version>.patch
Use the patch with the greatest <patch version> -- old patches are
shipped with the distribution so you can revert old patch(es) and apply
the new one on upgrades.
If you are using RT 3.6.1 or later, you no longer need to apply a patch.
CONFIGURE
Add 'Filter::TakeAction' to the list of mail plugins in RT_SiteConfig.pm.
(You'll need to add Auth::MailFrom to the list as well if you want to run the
test suite. Auth::MailFrom is distributed with RT as
RT::Interface::Email::Auth::MailFrom.)
Restart web server.
Note that Filter::TakeAction should be pushed into list *after* Auth::MailFrom
or any similar plugin that loads a current user object.
You can do this by adding the following line to your RT::SiteConfig:
Set(@MailPlugins, qw(Auth::MailFrom Filter::TakeAction));
If you are running a version of RT before 3.8, you will need to write.
@MailPlugins = qw(Auth::MailFrom Filter::TakeAction);
You will also need to add RT::Extension::CommandByMail to your
Plugins list.
Set(@Plugins,(qw(RT::Extension::CommandByMail)))
There is an optional configuration option CommandByMailGroup
Set($CommandByMailGroup, group_id);
You can find the id by browsing to Configuration -> Groups
You can get it to look for commands in headers as well by setting
CommandByMailHeader like:
Set($CommandByMailHeader, "X-RT-Command");
If you only want it to look in headers and not the body, you can set
CommandByMailOnlyHeaders to a true value, like:
Set($CommandByMailOnlyHeaders, 1);
Enjoy.
......@@ -18,33 +18,71 @@ RT::Extension::CommandByMail - Change metadata of ticket via email
AddCc: dev1@example.com
AddCc: dev2@example.com
Here goes comment/reply
The comment/reply text goes here
=head1 DESCRIPTION
This extension allows you to manage tickets via email interface.
You put commands into beginning of a mail and extension applies
This extension allows you to manage tickets via email interface. You
may put commands into beginning of a mail, and extension will apply
them. See the list of commands in the
L<RT::Interface::Email::Filter::TakeAction> docs.
CAVEAT: commands are line oriented, so you can't expand to multiple
B<CAVEAT:> commands are line oriented, so you can't expand to multiple
lines for each command, i.e. values can't contains new lines.
=head1 SECURITY
This extension has no extended auth system, so all security issues
that applies to the RT in general also applies to the extension.
This extension has no extended auth system; so all security issues that
apply to the RT in general also apply to the extension.
=head1 INSTALLATION AND CONFIGURATION
=head1 INSTALLATION
Read L<INSTALL>. Note that you B<must patch> RT
to use this extension, so read the file.
=over
=item C<perl Makefile.PL>
=item C<make>
=item C<make install>
May need root permissions
=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
Add this line:
Set(@Plugins, ( @Plugins, "RT::Extension::CommandByMail" ));
As well as:
Set(@MailPlugins, qw(Auth::MailFrom Filter::TakeAction));
If you already have a C<@MailPlugins> configuration line, add
C<Filter::TakeAction> B<after> any authentication plugins (such as
C<Auth::MailFrom> or C<Auth::Crypt>).
=item Restart your webserver
=back
=head1 CONFIGURATION
=head2 C<$CommandByMailGroup>
You may set a C<$CommandByMailGroup> to a particular group ID in RT_SiteConfig.
If set, only members of this group may perform commands by mail.
=head2 C<$CommandByMailHeader>
You may set this configuration value to the name of a header to examine
as well. For example:
Set($CommandByMailHeader, "X-RT-Command");
=head2 C<$CommandByMailOnlyHeaders>
If set, the body will not be examined, only the headers.
=head1 CAVEATS
This extension is incompatible with C<UnsafeEmailCommands> RT option.
......@@ -58,7 +96,7 @@ Shawn Moore C<< <sartak@bestpractical.com> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2006-2008, Best Practical Solutions, LLC. All rights reserved.
Copyright (c) 2006-2013, Best Practical Solutions, LLC. All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
......
--- lib/RT/Interface/Email.pm 2006-05-17 06:05:17.000000000 +0400
+++ lib/RT/Interface/Email.pm 2006-05-17 06:29:42.000000000 +0400
@@ -544,10 +544,9 @@
$args{'ticket'} ||= ParseTicketId($Subject);
- my $SystemTicket;
+ my $SystemTicket = RT::Ticket->new($RT::SystemUser);
my $Right = 'CreateTicket';
if ( $args{'ticket'} ) {
- $SystemTicket = RT::Ticket->new($RT::SystemUser);
$SystemTicket->Load( $args{'ticket'} );
# if there's an existing ticket, this must be a reply
$Right = 'ReplyToTicket';
@@ -570,6 +569,10 @@
push @RT::MailPlugins, "Auth::MailFrom" unless @RT::MailPlugins;
+ # if plugin returns AuthStat -2 we skip action
+ # NOTE: this is experimental API and it would be changed
+ my %skip_action = ();
+
# Since this needs loading, no matter what
foreach (@RT::MailPlugins) {
@@ -604,11 +607,12 @@
# If a module returns a "-1" then we discard the ticket, so.
- $AuthStat = -1 if $NewAuthStat == -1;
+ $AuthStat = $NewAuthStat if $NewAuthStat == -1 or $NewAuthStat == -2;
# You get the highest level of authentication you were assigned.
$AuthStat = $NewAuthStat if $NewAuthStat > $AuthStat;
last if $AuthStat == -1;
+ $skip_action{ $args{'action'} }++ if $AuthStat == -2;
}
# {{{ If authentication fails and no new user was created, get out.
@@ -730,7 +734,7 @@
my $Ticket = RT::Ticket->new($CurrentUser);
# {{{ If we don't have a ticket Id, we're creating a new ticket
- if ( !$SystemTicket || !$SystemTicket->Id) {
+ if ( (!$SystemTicket || !$SystemTicket->Id) && !$skip_action{ $args{'action'} } ) {
# {{{ Create a new ticket
@@ -769,10 +773,10 @@
# }}}
# If the action is comment, add a comment.
- elsif ( $args{'action'} =~ /^(comment|correspond)$/i ) {
- $Ticket->Load( $args{'ticket'} );
+ elsif ( $args{'action'} =~ /^(comment|correspond)$/i && !$skip_action{ $args{'action'} } ) {
+ $Ticket->Load( $SystemTicket->Id );
unless ( $Ticket->Id ) {
- my $message = "Could not find a ticket with id " . $args{'ticket'};
+ my $message = "Could not find a ticket with id " . $SystemTicket->Id || $args{'ticket'};
MailError(
To => $ErrorsTo,
Subject => "Message not recorded",
@@ -803,7 +807,7 @@
}
}
- else {
+ elsif ( !$skip_action{ $args{'action'} } ) {
#Return mail to the sender with an error
MailError(
--- lib/RT/Interface/Email.pm 2005-08-03 04:18:54.000000000 +0400
+++ lib/RT/Interface/Email.pm 2006-05-17 07:39:13.000000000 +0400
@@ -540,10 +540,9 @@
$args{'ticket'} ||= ParseTicketId($Subject);
- my $SystemTicket;
+ my $SystemTicket = RT::Ticket->new($RT::SystemUser);
my $Right = 'CreateTicket';
if ( $args{'ticket'} ) {
- $SystemTicket = RT::Ticket->new($RT::SystemUser);
$SystemTicket->Load( $args{'ticket'} );
# if there's an existing ticket, this must be a reply
$Right = 'ReplyToTicket';
@@ -566,6 +565,10 @@
push @RT::MailPlugins, "Auth::MailFrom" unless @RT::MailPlugins;
+ # if plugin returns AuthStat -2 we skip action
+ # NOTE: this is experimental API and it would be changed
+ my %skip_action = ();
+
# Since this needs loading, no matter what
foreach (@RT::MailPlugins) {
@@ -602,12 +605,13 @@
# If a module returns a "-1" then we discard the ticket, so.
- $AuthStat = -1 if $NewAuthStat == -1;
+ $AuthStat = $NewAuthStat if $NewAuthStat == -1 or $NewAuthStat == -2;
# You get the highest level of authentication you were assigned.
$AuthStat = $NewAuthStat if $NewAuthStat > $AuthStat;
last if $AuthStat == -1;
+ $skip_action{ $args{'action'} }++ if $AuthStat == -2;
}
last if $AuthStat == -1;
@@ -729,6 +733,12 @@
# }}}
+ # strip skipped actions
+ @actions = grep !$skip_action{$_}, @actions;
+
+ # if plugin changed system ticket then we should update ticket
+ $args{'ticket'} = $SystemTicket->Id if $SystemTicket && $SystemTicket->Id;
+
my $Ticket = RT::Ticket->new($CurrentUser);
# {{{ If we don't have a ticket Id, we're creating a new ticket
--- lib/RT/Interface/Email.pm 2005-08-03 04:18:54.000000000 +0400
+++ lib/RT/Interface/Email.pm 2006-05-17 07:39:13.000000000 +0400
@@ -540,10 +540,9 @@
$args{'ticket'} ||= ParseTicketId($Subject);
- my $SystemTicket;
+ my $SystemTicket = RT::Ticket->new($RT::SystemUser);
my $Right = 'CreateTicket';
if ( $args{'ticket'} ) {
- $SystemTicket = RT::Ticket->new($RT::SystemUser);
$SystemTicket->Load( $args{'ticket'} );
# if there's an existing ticket, this must be a reply
$Right = 'ReplyToTicket';
@@ -566,6 +565,10 @@
push @RT::MailPlugins, "Auth::MailFrom" unless @RT::MailPlugins;
+ # if plugin returns AuthStat -2 we skip action
+ # NOTE: this is experimental API and it would be changed
+ my %skip_action = ();
+
# Since this needs loading, no matter what
foreach (@RT::MailPlugins) {
@@ -602,12 +605,13 @@
# If a module returns a "-1" then we discard the ticket, so.
- $AuthStat = -1 if $NewAuthStat == -1;
+ $AuthStat = $NewAuthStat if $NewAuthStat == -1 or $NewAuthStat == -2;
# You get the highest level of authentication you were assigned.
$AuthStat = $NewAuthStat if $NewAuthStat > $AuthStat;
last if $AuthStat == -1;
+ $skip_action{ $args{'action'} }++ if $AuthStat == -2;
}
last if $AuthStat == -1;
@@ -729,6 +733,12 @@
# }}}
+ # strip skipped actions
+ @actions = grep !$skip_action{$_}, @actions;
+
+ # if plugin changed system ticket then we should update ticket
+ $args{'ticket'} = $SystemTicket->Id if $SystemTicket && $SystemTicket->Id;
+
my $Ticket = RT::Ticket->new($CurrentUser);
# {{{ If we don't have a ticket Id, we're creating a new ticket
This diff is collapsed.
This diff is collapsed.
240a241
> my $message_id = $args{'MIMEObj'}->head->get('Message-Id');
244a246,247
> $RT::Logger->debug("Message-ID: $message_id");
> # the colons are necessary to make ->build include non-standard headers
251,252c254,256
< Precedence => 'bulk',
< 'X-RT-Loop-Prevention' => $RT::rtname,
---
> 'Precedence:' => 'bulk',
> 'X-RT-Loop-Prevention:' => $RT::rtname,
> 'In-Reply-To:' => $message_id,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment