Hmm another interesting suggestion, thanks!
But aren’t you checking that it’s the owner that’s doing the resolving?
if ( $Ticket->OwnerObj->Name eq $session{‘CurrentUser’}->Name )
I’m after letting the customer resolve, and they won’t be the owner.
Also you’re calling the SetStatus function. Doesn’t that check that
you have ModifyTicket?
} else {
unless ($self->CurrentUserHasRight('ModifyTicket')) {
return ( 0, $self->loc('Permission Denied') );
}
}
Or does that code in <%INIT> run as if you’re the main RT user or
something, thus you have permission if you run SetStatus in <%INIT>?
Justin
Justin Hayes
Support Manager
justin.hayes@orbisuk.comOn 25 Jun 2008, at 10:08, Brian Gallew wrote:
Justin Hayes wrote:
I’d like to offer my customers an option to resolve a ticket
themselves, however I don’t want them to have the Modify Ticket
permission (which I think is the one you need for changing status).
Does anyone know of a way round this? I’m running 3.6.3
Sure. Create
$RTHOME/local/html/Callbacks/orbisuk/SelfService/Elements/Tabs/
Default that looks something like this:
==========================CUT HERE==========================
<%ARGS>
$actions
$Ticket
</%ARGS>
<%INIT>
if ($Ticket) {
my $id = $Ticket->id();
if ( $Ticket->OwnerObj->Name eq $session{‘CurrentUser’}->Name ) {
$actions->{‘D’} = { path => “SelfService/Resolve.html?id=” . $id,
title => loc(‘Owner Resolve’) };
};
}
</%INIT>
%# Local Variables:
%# mode:perl
%# End:
==========================CUT HERE==========================
Then you’ll need to create $RTHOME/local/html/SelfService/Resolve.html
==========================CUT HERE==========================
<%ARGS>
$Ticket
</%ARGS>
<%INIT>
if ($Ticket) {
my $id = $Ticket->id();
if ( $Ticket->OwnerObj->Name eq $session{‘CurrentUser’}->Name ) {
$Ticket->SetStatus(‘resolved’);
};
}
RT::Interface::Web::Redirect($RT::WebURL.“SelfService/”);
</%INIT>
%# Local Variables:
%# mode:perl
%# End:
==========================CUT HERE==========================
Caveat emptor: I’ve modeled the code after something I have running
which is similary, but I’ve never actually run it, so you may have
to experiment. Especially since I don’t actually do Perl. 8)
Also, notice that this marks the ticket resolved without actually
allowing the opportunity to add any commentary.