Welcome Guest, Not a member yet? Register   Sign In
Prevent direct access
#1

[eluser]Giga[/eluser]
I created an authentication mechanism that makes access to different areas for each type of user logged. However, to avoid direct access I thought of using a hook before the controller ... This is a good idea?
I would like to avoid writing the control code for each function of the controller ...
Or just put the control code in the constructor of the controller?
#2

[eluser]Narkboy[/eluser]
Always keep it simple! If your auth code controls access to the functions within the controller, then run it in the constructor and you're done.

If the auth code controls access to other controllers or to other assets, then I would probably place it into the constructor of a library, and auto-load the lib. I try to avoid hooks and have never needed to have one yet.

More detail on what the auth code does would help to understand exactly what you're after!

GL!




Theme © iAndrew 2016 - Forum software by © MyBB