Back
filters()
1. Run a filter before all actions
// Always execute restrictAccess before every action
filters("restrictAccess");
2. Multiple filters before all actions
// Run both isLoggedIn and checkIPAddress before all actions
filters(through="isLoggedIn, checkIPAddress");
3. Exclude specific actions
// Run filters before all actions, except home and login
filters(through="isLoggedIn, checkIPAddress", except="home, login");
4. Limit filters to specific actions
// Only run ensureAdmin before the delete action
filters(through="ensureAdmin", only="delete");
5. Run filters after an action
// Run logAction after every action
filters(through="logAction", type="after");
Copied!