2 login types for 2 different users

Hello, international community :-*

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 ?

Please give me some advices or examples.


Hi Karasko,

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…


There’s nothing a customer has and an admin doesn’t, or the other way round: userid, username, password, email.

Maybe a customer has a profile, but THAT is your “other” table. Simply don’t create rows for admins in profiles or similar tables.

I’ve seen this scheme (separation customers and employees in various tables ) in some shop cms, like prestashop.

But may be you are right guys :blink:

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…

Hope this helps.



Why something like this will not work for you.

So there will be one table and maybe with a table ‘profile’ (or 1 table with all fields).