Praveen kalal
Praveen kalal

Reputation: 2129

how to authenticate an admin and user in cakephp

i am using cakephp framework for my project. but problem is that in my project there are four users like admin,user,employer,bla bla.if all are simultaneously login than how can i authenticate them to right access. so plz help me.....

thanks in advance

Upvotes: 0

Views: 2536

Answers (2)

Muhammad Yasir
Muhammad Yasir

Reputation: 646

By default CakePHP uses a model like User fro Auth component. You can use this model for one type of users, and different Models for rest of the user types... This way all types of users can login to your site simultaneously, from a single machine. If you don't do this, only one type of users can login at a time.

Upvotes: 1

David Yell
David Yell

Reputation: 11855

You'll want to use the Auth component. Have a look on the manual page, http://book.cakephp.org/view/172/Authentication

Then, what I tend to use is in my Users table, I'll add a column, permissions or similar, and then add in the user type to this column.

Then you can use the isAuthorized() function in your app_controller.php to check the levels for various controller actions.

There are lots of possible ways of achieving this, you could even use the ACL if you wanted.

Upvotes: 1

Related Questions