• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filter system in 2.0?

#1
[eluser]froginvasion[/eluser]
The authentication needs in our application are quite simple, using another framework for this would be overkill, since we don't need to assign attributes to roles. We just need a very simple system that restricts access by roles.

I thought, well this could be easily implemented using a filter, heck: it would even save me from fiddling in the controller, which is a nasty thing to do really. So when googling I stumbled upon:
http://codeigniter.com/wiki/Filters_system/

Does anybody know if this is still actively used, and does work in Code Ignite 2.0? I've used the wiki and set all the configuration settings, files, etc, but I don't seem to be able to get it to work.

Code:
class Auth_Filter extends Filter {
function before(){
redirect('login/index');
}
}

Code:
$filter['auth'] = array('include', array('*'), array());

#2
[eluser]WanWizard[/eluser]
I find it a very complicated way of doing something very simple. I suggest you use a base controller, and do your checking there: http://philsturgeon.co.uk/news/2010/02/C...ing-it-DRY

I understand that before() and after() methods are on the roadmap of the reactor guys, but as of now it's not there...

#3
[eluser]froginvasion[/eluser]
Ok, I'll have a look at that link! Looks interesting. I've already thought of
extending classes to handle it.

Well, filters is just something that naturally comes to mind when thinking about something like authentication.
You might understand better when I say I come from a Java background. In those web frameworks,
filters is almost second nature to split things totally like transactions, logging, authentication, etc.

thanks for the answer!

#4
[eluser]WanWizard[/eluser]
Which is why a lot of java apps are slow as hell... Wink

If you have a complicated setup where you need to do a lot of different things, then a more flexible filter system sure would be the preferred option, if only from a standardisation point of view. But even then I would fire it from a base controller constructor, instead of from all kinds of hooks...

#5
[eluser]froginvasion[/eluser]
I checked out the site and that helped to convince me!
You're right that this is a clean solution as well, and it's more than
flexible enough for what I need. Smile

Thank you ! Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.