[Bps-public-commit] RT-Extension-SLA branch, assume-outside-actor, created. 1.02-1-g7fc6467
Todd Wade
todd at bestpractical.com
Wed Dec 3 14:39:23 EST 2014
The branch, assume-outside-actor has been created
at 7fc64672190c5aab95d3c27f4a7f69300ece9283 (commit)
- Log -----------------------------------------------------------------
commit 7fc64672190c5aab95d3c27f4a7f69300ece9283
Author: Todd Wade <todd at bestpractical.com>
Date: Wed Dec 3 14:32:36 2014 -0500
provide AssumeOutsideActor functionality to SLA_SetDue.pm's LastEffectiveAct
By default replies to a ticket submitted by anyone who is not a requestor unsets
the due date. If it is common for non requestors to reply to tickets, this isn't
desirable. This commit provides a way to bypass due date manipulation for
replies from people besides requestors.
* rename IsRequestorsAct to IsOutsideActor
* conditional based on config flag
- when config is set
* ticket adminccs are inside actors
* admincc watchers are inside actors
* all others are outside actors
- when config is not set
* default / existing behavior, only requestors are outside actors
* documentation
* replace 'requestor' with 'outside actor' where necessary
* replace 'non-requestor' with 'inside actor where necessary
* reminder that this needs tests
diff --git a/lib/RT/Action/SLA_SetDue.pm b/lib/RT/Action/SLA_SetDue.pm
index 06bf646..12ea534 100644
--- a/lib/RT/Action/SLA_SetDue.pm
+++ b/lib/RT/Action/SLA_SetDue.pm
@@ -65,16 +65,55 @@ sub Commit {
return $self->SetDateField( Due => $due );
}
-sub IsRequestorsAct {
+sub IsOutsideActor {
my $self = shift;
my $txn = shift || $self->TransactionObj;
my $actor = $txn->CreatorObj->PrincipalObj;
- # owner is always treated as non-requestor
- return 0 if $actor->id == $self->TicketObj->Owner;
+ # owner is always treated as inside actor
+ if ( $actor->id == $self->TicketObj->Owner ) {
+ $RT::Logger->debug('IsOutsideActor: inside actor via owner, returning 0');
+ return 0;
+ }
+
+ if ( $RT::ServiceAgreements{'AssumeOutsideActor'} ) { # all non-admincc users are outside actors
+ $RT::Logger->debug('IsOutsideActor: AssumeOutsideActor IS set');
+ # inside actor if actor is a ticket admincc
+ my $TicketAdminCcs = RT::Group->new( $RT::SystemUser );
+ $TicketAdminCcs->LoadTicketRoleGroup(
+ Type => 'AdminCc',
+ Ticket => $self->TicketObj->Id
+ );
+ if ( $TicketAdminCcs->HasMemberRecursively($actor->Id) ) {
+ $RT::Logger->debug('IsOutsideActor: inside actor via ticket admincc, returning 0');
+ return 0 ;
+ }
- return $self->TicketObj->Requestors->HasMemberRecursively( $actor )? 1 : 0;
+ # inside actor if actor is a queue admincc
+ my $GroupAdminCcs = RT::Group->new( $RT::SystemUser );
+ $GroupAdminCcs->LoadQueueRoleGroup(
+ Type => 'AdminCc',
+ Queue => $self->TicketObj->QueueObj->Id
+ );
+ if ( $GroupAdminCcs->HasMemberRecursively($actor->Id) ) {
+ $RT::Logger->debug('IsOutsideActor: inside actor via group admincc, returning 0');
+ return 0 ;
+ }
+
+ # if we got here assume we have an outside actor
+ $RT::Logger->debug('IsOutsideActor: outside actor via non-admincc, returning 1');
+ return 1;
+ } else { # only requestors are outside actors
+ $RT::Logger->debug('IsOutsideActor: AssumeOutsideActor IS NOT set');
+ if ( $self->TicketObj->Requestors->HasMemberRecursively( $actor ) ) {
+ $RT::Logger->debug('IsOutsideActor: outside actor via requestor, returning 1');
+ return 1;
+ } else {
+ $RT::Logger->debug('IsOutsideActor: inside actor via non-requestor, returning 0');
+ return 0;
+ }
+ }
}
sub LastEffectiveAct {
@@ -90,7 +129,7 @@ sub LastEffectiveAct {
my $res;
while ( my $txn = $txns->Next ) {
- unless ( $self->IsRequestorsAct( $txn ) ) {
+ unless ( $self->IsOutsideActor( $txn ) ) {
last if $res;
return ($txn);
}
diff --git a/lib/RT/Extension/SLA.pm b/lib/RT/Extension/SLA.pm
index 3354202..0f95816 100644
--- a/lib/RT/Extension/SLA.pm
+++ b/lib/RT/Extension/SLA.pm
@@ -169,26 +169,26 @@ Example:
In many companies providing support service(s) resolve time
of a ticket is less important than time of response to requestors
-from stuff members.
+from staff members.
You can use Response option to define such deadlines. When you're
-using this option Due time "flips" when requestors and non-requestors
+using this option Due time "flips" when outside actors and inside actors
reply to a ticket. We set Due date when a ticket is created, unset
-when non-requestor replies... until ticket is closed when ticket's
+when inside actor replies... until ticket is closed when ticket's
Due date is also unset.
B<NOTE> that behaviour changes when Resolve and Response options
are combined, read L<below|/"Using both Resolve and Response in the same level">.
-As response deadlines are calculated using requestors' activity
+As response deadlines are calculated using outside actors' activity
so several rules applies to make things sane:
=over 4
=item *
-If requestor(s) reply multiple times and are ignored then the deadline
-is calculated using the oldest requestors' correspondence.
+If outside actor(s) reply multiple times and are ignored then the deadline
+is calculated using the oldest outside actors' correspondence.
=item *
@@ -201,7 +201,7 @@ If a ticket is created by non-requestor then due date is left unset.
=item *
If owner of a ticket is its requestor then his actions are treated
-as non-requestors'.
+as an inside actor.
=back
@@ -213,7 +213,7 @@ according to the earliest of two deadlines and never is dropped to
If a ticket met its Resolve deadline then due date stops "flipping",
is freezed and the ticket becomes overdue. Before that moment when
-non-requestor replies to a ticket, due date is changed to Resolve
+an inside actor replies to a ticket, due date is changed to Resolve
deadline instead of 'Not Set', as well this happens when a ticket
is closed. So all the time due date is defined.
@@ -267,7 +267,7 @@ every few hours. KeepInLoop option can be used to achieve this.
},
In the above example Due is set to one hour after creation, reply
-of a non-requestor moves Due date two hours forward, requestors'
+of a inside actor moves Due date two hours forward, outside actors'
replies move Due date to one hour and resolve deadine is 24 hours.
=head2 Modifying Agreements
@@ -368,6 +368,20 @@ In the config you can set per queue defaults, using:
...
};
+=head2 AssumeOutsideActor
+
+When using a L<Response|/"Resolve and Response (interval, no defaults)">
+configuration, by default replies to a ticket submitted by anyone who is not a
+requestor unsets the due date. If it is common for non requestors to reply to
+tickets, this isn't desirable. Setting AssumeOutsideActor causes the extension
+to assume that the due date should only be "flipped" when replies from the owner
+or AdminCc users are submitted.
+
+ %RT::ServiceAgreements = (
+ AssumeOutsideActor => 1,
+ ...
+ };
+
=head2 Access control
You can totally hide SLA custom field from users and use per queue
@@ -552,6 +566,9 @@ sub GetDefaultServiceLevel {
something else). So people would be able to handle tickets in the right
order using Due dates.
+ * [not implemented] tests for AssumeOutsideActor - need tests for all of the
+ conditionals in RT::Action::SLA_SetDue::IsOutsideActor
+
* [not implemented] WebUI
=head1 DESIGN
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list