[rt-users] Trying to change disabled users to Nobody in Scrips upon Correspond...
Alexander List
alexlist at sbox.tu-graz.ac.at
Wed Aug 31 04:45:12 EDT 2005
Hello!
I'm trying to achieve the following:
When someone replies to a ticket that is owned by a disabled user, I
want to change the ticket owner to Nobody. This is to have it show up in
"unowned tickets" and avoid negligence on the part of the users...
I did the following:
- add a Global Scrip
Description: ChangeDisabledOwnerToNobody
Condition: User defined
Action: User defined
Template: Global template: Blank
Stage: TransactionCreate
Custom condition:
my $disabled = $self->TicketObj->OwnerObj->Disabled;
if ($disabled) {
$RT::Logger->info("Ticket owner of Ticket #" . $self->TicketObj->Id . "
is disabled.");
return 1;
} else {
return undef;
}
Custom action preparation code:
return 1;
Custom action cleanup code:
$RT::Logger->info("Changing owner of Ticket #" . $self->TicketObj->Id .
" to Nobody.");
my ($status, $msg) = $self->TicketObj->SetOwner($RT::Nobody->Id, 'Force');
unless( $status ) {
$RT::Logger->crit("Error: " . $msg);
}
return 1;
The testing for the disabled status works as expected:
[Tue Aug 30 15:03:04 2005] [debug]: About to think about scrips for
transaction #590718
(/usr/share/request-tracker3.4/lib/RT/Transaction_Overlay.pm:154)
[Tue Aug 30 15:03:04 2005] [debug]: About to prepare scrips for
transaction #590718
(/usr/share/request-tracker3.4/lib/RT/Transaction_Overlay.pm:158)
[Tue Aug 30 15:03:04 2005] [debug]: Found 6 scrips
(/usr/share/request-tracker3.4/lib/RT/Scrips_Overlay.pm:354)
...
[Tue Aug 30 15:03:05 2005] [info]: Ticket owner of Ticket #1887036 is
disabled. ((eval 400):3)
[Tue Aug 30 15:03:05 2005] [info]: Changing owner of Ticket #1887036 to
Nobody. ((eval 405):1)
However, I get the following error after SetOwner:
[Tue Aug 30 15:03:05 2005] [err]: Disabled User: 684 failed access
check for DelegateRights
(/usr/share/request-tracker3.4/lib/RT/Principal_Overlay.pm:307)
I don't actually understand what SetOwner has to do with DelegateRights...
TIA for any hints!
Alex
BTW, I'm using RT 3.4.2 as packaged in Debian (3.4.2-4).
More information about the rt-users
mailing list