Redirect when no access / no rights?

Hello,

as described in 514C70F2.1040200@pgs-info.de, I run two queues, Level1
and Level2. My Level2 users now have a custom
status “returned”. When chosing this status for a ticket, the ticket
will change the queue to Level1, will be set to unowned and escalations
will be reset to the beginning. This whole thing works fine.

The only thing: As soon as the tickets’ level is set to “returned” and
so the queue has changed, the user gets an error site: “No permission to
view ticket”

Which is correct, because the ticket has left his queue.

Is it possible to redirect the user to his RT at a glance site in this
case? Yes, it’s jaust a click, but a displayed error may be disturbing
for the user, especially when he did nothing wrong.

Thanks in advence, Patrick

Hi,

There is no suitable callbacks for this. You can search for Abort in
Ticket/Display.html and place a callback yourself just before abort calls.
Other way is to wrap Abort check caller with perl’s caller function
(perldoc -f caller) and do redirect when it’s Ticket/Display.html. To do
redirect take a look at MaybeRedirectForResults calls.

I like what you want to do and I think Display.html can be refactored to
make it much easier to implement “redirect to different place if user has
no rights to see ticket after changes”, so good patches are welcome.On Fri, Apr 12, 2013 at 5:05 PM, Patrick G. Stoesser lists@pgs-info.dewrote:

Hello,

as described in 514C70F2.1040200@pgs-info.de**, I run two queues,
Level1 and Level2. My Level2 users now have a custom
status “returned”. When chosing this status for a ticket, the ticket
will change the queue to Level1, will be set to unowned and escalations
will be reset to the beginning. This whole thing works fine.

The only thing: As soon as the tickets’ level is set to “returned” and so
the queue has changed, the user gets an error site: “No permission to view
ticket”

Which is correct, because the ticket has left his queue.

Is it possible to redirect the user to his RT at a glance site in this
case? Yes, it’s jaust a click, but a displayed error may be disturbing for
the user, especially when he did nothing wrong.

Thanks in advence, Patrick

Best regards, Ruslan.

Hello,

this modification works for me: In

RTLOCAL/html/Ticket/Display.html, around line 180,

change

XXX: we shouldn’t block actions here if user has no right to see the

ticket,

but we should allow him to see actions he has done

     unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
     Abort("No permission to view ticket");
     }

to

XXX: we shouldn’t block actions here if user has no right to see the

ticket,

but we should allow him to see actions he has done

     unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
begin mod redirect when no permission

Abort(“No permission to view ticket”);

RT::Interface::Web::Redirect(RT->Config->Get(‘WebURL’).‘index.html’);

end mod redirect when no permission
     }

From now on, when a user has no right to see a ticket, he will be
immediately redirected to index.html (RT at a glance).

Possible drawback of my solution: The user does not get an explicit
error message (“No permission to view ticket”) anymore.
A possible solution could be to give out the error status and redirect
after one or two seconds to index.html.

Kind regards,PatrickAm 12.04.2013 15:05, schrieb Patrick G. Stoesser:

Hello,

as described in 514C70F2.1040200@pgs-info.de, I run two queues,
Level1 and Level2. My Level2 users now have a custom status
“returned”. When chosing this status for a ticket, the ticket will
change the queue to Level1, will be set to unowned and escalations
will be reset to the beginning. This whole thing works fine.

The only thing: As soon as the tickets’ level is set to “returned”
and so the queue has changed, the user gets an error site: “No
permission to view ticket”

Which is correct, because the ticket has left his queue.

Is it possible to redirect the user to his RT at a glance site in
this case? Yes, it’s jaust a click, but a displayed error may be
disturbing for the user, especially when he did nothing wrong.

Thanks in advence, Patrick

Hello,

this modification works for me: In

RTLOCAL/html/Ticket/Display.**html, around line 180,

change

XXX: we shouldn’t block actions here if user has no right to see the

ticket,

but we should allow him to see actions he has done

    unless ($TicketObj->**CurrentUserHasRight('**ShowTicket')) {
    Abort("No permission to view ticket");
    }

to

XXX: we shouldn’t block actions here if user has no right to see the

ticket,

but we should allow him to see actions he has done

    unless ($TicketObj->**CurrentUserHasRight('**ShowTicket')) {
begin mod redirect when no permission

Abort(“No permission to view ticket”);

RT::Interface::Web::Redirect(**RT->Config->Get(‘WebURL’).‘**index.html’);

end mod redirect when no permission
    }

From now on, when a user has no right to see a ticket, he will be
immediately redirected to index.html (RT at a glance).

Possible drawback of my solution: The user does not get an explicit error
message (“No permission to view ticket”) anymore.

I pointed you at MaybeRedirectForResults for a reason, it stashes messages
and those will be displayed on “RT at glance page”.

A possible solution could be to give out the error status and redirect
after one or two seconds to index.html.

Kind regards,Patrick

Am 12.04.2013 15:05, schrieb Patrick G. Stoesser:

Hello,

as described in 514C70F2.1040200@pgs-info.de**, I run two queues,
Level1 and Level2. My Level2 users now have a custom status
“returned”. When chosing this status for a ticket, the ticket will
change the queue to Level1, will be set to unowned and escalations
will be reset to the beginning. This whole thing works fine.

The only thing: As soon as the tickets’ level is set to “returned”
and so the queue has changed, the user gets an error site: “No
permission to view ticket”

Which is correct, because the ticket has left his queue.

Is it possible to redirect the user to his RT at a glance site in
this case? Yes, it’s jaust a click, but a displayed error may be
disturbing for the user, especially when he did nothing wrong.

Thanks in advence, Patrick

Best regards, Ruslan.