Hi all,
I have some code to detect a logged-in-user's permissions, I want to display a 403 page in a similar way to a \Request::show_404();
Is there a built in way of doing this? How have you implemented this in your project?
All the best
Rob McCann
To anyone wondering about this, I now extend the HTTP status classes from the core in my app/classes folder and do all my processing there rather than in action_404 or action_403
Better way might have been to implement a router() method in your controller and do this type of processing there. before() isn't intended to perform any routing-like functionality (including generating responses), the before() method is just there to set everything up you need when the action method is executed. The after() method is meant to post-process the response once generated by the controller.
Setting the response status code is part of routing logic as it involves generating a response, thus it belongs in a router() method.