[rt-users] Scrip for changing ownership on a case.
Bjørn Skovlund Rydén
bjorn at 247ms.com
Mon Aug 22 11:51:20 EDT 2005
Hi!
I want our customers to be able to own cases, in which we need a response from them. I have tried to do this by keeping them "Unprivileged" and giving them the "Own Ticket" ACL.
Now, I don't want customers to be able to Modify the ticket, as they shouldn't be able to assign it to anyone or change it's queue.
So in order for a customer to be able to return a ticket to us once he has replied, I was thinking of running a scrip to do it.
The scrip doesn't seem to work for various reasons though. The user doesn't have the right to make the change to Nobody, and I think I messed a few other things up too.
Can somebody help me with this? Or maybe somebody been in the same situation and solved it differently?
Cheers, Bjorn
============================================
So the scrip I came up with looks like this:
Condition: On Correspond
Action: User Defined
Template: Blank
Stage: TransactionCreate
Custom action prepareation code:
return 1;
Custom action cleanup code:
# get actor ID
my $Actor = $self->TransactionObj->Creator;
# if actor is RT_SystemUser then get out of here
return 1 if $Actor == $RT::SystemUser->id;
# Get out unless actor is owner
return 1 unless $Actor == $self->TicketObj->Owner;
# Get out unless user is unprivileged
my $groupobj = new RT::Group($self->TicketObj->Owner);
$groupobj->LoadSystemInternalGroup('Unprivileged');
return 1 unless $groupobj->HasMemberRecursively($Actor);
# We should now be ok to make changes:
my ($status, $msg) = $self->TicketObj->SetOwner($RT::Nobody->id);
unless( $status ) {
$RT::Logger->warning( "Error setting ownership to nobody: $msg" );
return undef;
}
return 1;
More information about the rt-users
mailing list