Yii Framework Forum: Separate database for group of users - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Separate database for group of users Can Yii support the ability to connect to different database schema Rate Topic: -----

#1 User is offline   drp666c 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 30-November 09

Posted 15 February 2010 - 07:05 PM

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.
0

#2 User is offline   sebas 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 496
  • Joined: 28-October 08
  • Location:Buenos Aires, Argentina

Posted 16 February 2010 - 03:50 AM

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
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users