Using a module specific database for access control

I’ve asked this same question at stackoverflow here (as that’s become my goto site for community support), but this is such a specific question the Yii forum might be a more appropriate venue.

I’m trying to set up a separate module for a special set users on my site. I’d like to store those users in a separate database and use a separate authentication for them. Where I’m having trouble is on user authentication. The module is using a module specific user identity class which works, but both my site database and my module database have Account tables (for authentication) and the module is using my site Account model as opposed to my module Account model. Is there any way I can convince the modules to select my module Account model?

Using two databases with yii can be a bit tricky:

The problem is that ActiveRecord by default is using default db connection from config file, so you will need to override few things.

To be more precisious, you will need to extend CWebUser, and to check two cases, when user access User module, and all other modules.

But I think you should look for simpler acceptable solution if possible.