Separate database for group of users

I’m still learning Yii and am wondering if Yii has the ability to facilitate connecting to different databases (same schema) for different group of users?

Database Setup (all have same schema)

** Common database to authenticate users

** Separate database for different group of users

Here is what I am attempting:

  1. Use one database to authenticate users

  2. Once user is authenticate depending on what group he/she belongs to the user will use different database

Example: I have 4 databases for 3 groups of users:

** Common database to authenticate users

** Separate database for Students

** Separate database for Teachers

** Separate database for Administrative Staff

The reason for having separate databases is because they are hosted on different machines for policy reasons.

Thanks for any advice.

I think you can do it by session. When user log in set a session variable for user tupe. Then in config change the dB data to include depends on session data.

Another way is to have different entry scripts for each type of user and it only changes the db connection data on the config