Welcome Guest, Not a member yet? Register   Sign In
What's the best way to create 'hooks' between the database and application?
#3

[eluser]jedd[/eluser]
That's very close to what I did, and I gather it's pretty common (well, variants of this approach).

Testing of Visitor .v. visitor is a bit too subtle to be worth the bother of making the distinction, I think.

In my MY_Controller, I have a few functions for basic things like 'is_logged_in' and 'is_admin', but I also experimented with having these as functions in the standard helper that I load on all my pages. 6 of one, I suspect, as both code chunks get loaded on every page. Oh, both functions check session data, I hasten to add - I don't do further db calls for this stuff once I've authenticated.

Some Controllers, where every method available requires a certain level of permissions (or at least to be logged in) can then easily be vetoed with a simple is_logged_in() followed by a redirect() in the constructor.

If you have just three types of user levels, and don't expect any further complexification of that hierarchy, then I reckon the same approach would serve you well.


Messages In This Thread
What's the best way to create 'hooks' between the database and application? - by El Forum - 07-24-2009, 06:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB