EllisLab text mark
Advanced Search
     
Another authorization issue…
Posted: 05 September 2007 06:12 PM   [ Ignore ]
Joined: 2007-09-05
3 posts

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

 
Posted: 05 September 2007 07:07 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-06
743 posts

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.

 Signature 

“I am the terror that flaps in the night”

 
Posted: 06 September 2007 05:39 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-07-24
82 posts

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