Trying to change disabled users to Nobody in Scrips upon Correspond

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).

Hello.
As I understand scrip works, but you’re confused with this [err] message.
When RT deletes user from group(ticket owner is also organized as
group) it checks if user can delegate rights because if he leave group
and he got rights via membership in this group he couldn’t delegate
that rights any more.
I think level of this message should be lower - info or may be debug,
but also may be there is bug in RT that doesn’t affect you, but
should be fixed.On 8/31/05, Alexander List alexlist@sbox.tu-graz.ac.at wrote:

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).

Best regards, Ruslan.

Ruslan Zakirov wrote:

   Hello.

As I understand scrip works, but you’re confused with this [err] message.

Err, for some reason I believed it doesn’t work - I just tested it
again, the Scrip works…

What I did: Create a ticket via e-mail, change the owner to User X,
disable user X, send a followup message to ticket X, owner gets changed
to Nobody.

So yes, all that’s left is this confusing [err] message. Thanks for your
help!

Alex