I am trying to determine how/when to use class-based filters for controller actions.
My scenario is that I need to restrict access to certain controller actions based on date - our site has an open ‘window’ of membership and when today’s date is outside of that window we cannot allow signups.
I think I’ve settled on a class-based filter (since this code is common to several different controllers. I created one and overrode the preFilter() function to do what I needed - I am throwing an http exception if the date is out of range and showing a custom error explaining whats up.
Is the main difference between a Filter and a controller event (like beforeAction) that Filters can be applied per action whereas the events are for the controller as a whole?