Wednesday, October 7, 2015

Re: CakePHP 3 Auth with two tables (models)

Make both your admins and applicants users, ie. in the users table.
Use an additional table to keep information about users (applicants).

Assign roles to your users, to indicate whether they are admins or applications. This can be done by having the role defined as a field in the users table or in another roles table, in case you in the future will have other kind of users.

Having one table with users, you may later be able to implement some ACL features. See the CakePHP book for that.

Hope this helps you on the way, enjoy,
John

On Wednesday, 7 October 2015 05:31:25 UTC+3, Hagler wrote:
I have two tables in my database, one for admins (named users) and the other one for normal users, (named applicants). Both tables use email and password for authentication, but applicants' table has more fields, that's why I need the separation.

What I want to do, is create two login pages, one for admins and the other for normal user. After logging in, the user is redirected to the page he is supposed to see. But yet, if the user tries attempt a forbidden location. I want be able to stop him (beforeFilter + isAuthorized).


I'm a beginner in Cakephp in general. How can I make all this work ?


Your help would be much appreciated.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: