Reputation: 20565
So i have two models
clients
employees
The main difference between these two are that employees has some different more advanced controls.
Now regardless of what user that logs in i need to set a cookie (what the cookie does doesnt matter just to give you an idea).
Now since my employees has more options and actions than clients there is a seperate index view for the.
Now to my question since both types of users has to set a cookie is it possible to do this from the client login controller meaning that "unknown person tries to log in" -> "checks client model if user exists" if not "check employees controler if user exists" if true -> "set cookie " ->"go to employee view index"
Is this possible and is it a good way to do it. Note that the reason why i need to do this is because i want to create a God like user in the clients table. My client table consists of alot of joins and it would be easier to create a "God like" user that will look the same as a normal client (kind of like a proxy).
Upvotes: 0
Views: 88
Reputation: 39439
I think you’ve gone about this the wrong way.
Ideally, you should have a users
table and a corresponding User
model, and then use ACL to determine what a user can and can’t do. You can create roles for clients and employees, and set permissions on these groups, and assign each user to a group.
If you have client- and employee-specific data you wish to store, then you can always create these tables/models and set them to belong to a User.
Upvotes: 2