mediaslave/phrails

Filters

Closed this issue · 3 comments

Right now the filters system is very immature.

You really can only have a couple of filters. There are no global filters. I need to create a filter object that will allow you to register filters in a more robust way.

In a Controller constructor this may look like:

$this->filter->before($filter, [$action,... ])

$this->filter->beforeExcept($filter, [$action,...])

$this->filter->around($filter, [$action,...])

$this->filter->aroundExcept($filter, [$action,...])

$this->filter->after($filter, [$action,...])

$this->filter->afterExcept(($filter, [$action, ...])

When a action is not specified it will be in the global scope for all. Multiple actions can be passed to any method.

This needs some more thought.

$this->filters()->after();

$this->filters()-remove($filter, [$action, ...]);

$this->filters()-removeExcept($filter, [$action, ...]);