pelle/oauth-plugin — Issue #93: Allow non-User model for Provider
Author: ideaoforder
Created: 2011-10-25 15:08:52+00:00
State: open

In some circumstances, folks may have a habtm like so:

Account
has _and_belongs_to_many :users
has_many :products

User
has _and_belongs_to_many :accounts

In this case, you'd want the oauth provider attached to the Account model, not the User model, since we it's the Account that's associated with Products (in this case). This mostly entails just changing the DB fields to :account_id and updating models accordingly, but _oauth-plugin / lib / oauth / controllers / provider_controller.rb_ references current_user repeatedly.

So,

1) Is there a hack to set the _current_user_ to the _current_account_?
2) Would it be feasible to modify this plugin to allow users to specify which model it should be associate with? (I'm certainly willing to fork and help out, but a little guidance would be useful.)