Welcome Guest, Not a member yet? Register   Sign In
Another authorization issue...
#1

[eluser]Unknown[/eluser]
Hello All,
Maybe it is simple issue but I have been fighting with this for a long time.

I want to develop application with user authorization.
Where shall I put check permissions and auhtorization functions ? In model, hooks or controllers ?

First I built separate controller called "Users" but I don't how to call this controller in other controllers ? (In every controller to check if your are logged in or not , if not it will send you to login view)

Another approach is to built in model but then I can't load views directly from model.

I am wondering what is your approach to this issue. I don't want to use any external classes and want to write it bymyself.

Regards
bastek
#2

[eluser]Rick Jolly[/eluser]
You could put the authorization check in your own library. Then include that library in the constructors of all controllers that require authorization. If there are a lot of those controllers, you might want to put the authorization check in one parent controller and extend it. There are lots of posts about extending the controller.
#3

[eluser]deviant[/eluser]
I used hooks and then put the required permissions for each controller/action in a config file.




Theme © iAndrew 2016 - Forum software by © MyBB