Welcome Guest, Not a member yet? Register   Sign In
Best way to handle authentication with MY_Controller ?
#8

[eluser]Damien K.[/eluser]
[quote author="benoa" date="1253376612"]
I'm just wondering if they are as fast as extending the Controller class in terms of performance...

Anyways, if you use a hook, you'll still have to implement some way to restrict access to parts of your site... How would you do that? Like, lock controllers at the application start, or otherwise inside controllers, put ifs and elses? I'm not sure I want to do that... Because I'm DRY![/quote]

I'll leave it up to you re: performance. Performance is usually a lower priority on my checklist -- I don't have traffic like Google does.

The hook would call Auth->validate() after the contructor of each controller. Auth->validate() does what you would normally do:
1) Validate if is_logged_in
2) If not, redirect to login page; if yes, match uri rules
3) If you have roles, you match roles first then match the uri rules

That's the gist of it. You should not have to add code to each of your controllers manually. Generally speaking, n0xie's example above is exactly what I'm trying to avoid -- too invasive for my liking.


Messages In This Thread
Best way to handle authentication with MY_Controller ? - by El Forum - 09-18-2009, 11:11 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-18-2009, 06:40 PM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 05:10 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 05:39 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 05:43 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 09:03 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 09:28 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 11:33 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 08:00 PM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 09:47 PM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 11:46 PM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-20-2009, 05:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB