• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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