I develop a system like online shop, and separate customers and administrators with different tables (and corresponding models COSTUMER and USER). I considered an option to merge them in one table (e.g. USERS with field user_type), but this goes against logic ihmo, actually they seems to be different entities.
Now i need two types of login to the site, one for the front-end other for back-end.
So i think how to realize this ?
One option is to add an additional second ‘user’ component to application, and store there session and authorization info related to the adminstrators, in first ‘user’ we store costumers and unregistered user session info.
And i’ll have 2 subclasses of CUserIdentity one for Costumer, other for User.
Also i don’t know is it possible to add second ‘user’ component to application ?
I’m not sure that using 2 users components is the solution. The ‘user_type’ solution seems ok for me (I don’t see why it goes agains logic). You could also use permissions to diferentiate any type of users…
I read alot of posts about a front-end and a back-end.
Most people treat this as 2 separate things with lots of difficulties to develop.
If you build a set of actions and put it in an AdminController (which may or may not be part of a separate module) and then use the filterAccessControl of the controller to grant or deny access to its actions, there is no difference between an ordinary user and an admin user, other than that the admin user is allowed access and the ordinary is not.
I have a separate module for my admin section…it works as a charm. It is separate than the regular users and having it in a separate module is a comfort for me. I have two different tables one for regular users and one for admins…I also have user privileges for each admin so I can add as many admins as I would like and assign separate roles for each. Managing the admin section in a separate module is very easy…