Make Some Check Before Execute Action

At the moment I’m working on creating some API for my company website (A webstore) and to do that someone before me have created a module for the API and I’ve created 2 controller CustomerController (to retrive customer the info and other stuff customer related) and FeedController (to retrive info about the product).

Everything works fine but now I’d like to add some check before any action (if the user is a registred user, the version of the app is using and if the website is in maintenance) and return a specific JSON message to the app, I’ve tried to use the beforeAction but is not really a solution because I can return only null to the app and not the error.

Anyone can help me with some suggestion?


Please post your beforeAction code.