doorkeeper-gem/doorkeeper — pull request #461 by JanStevens (2014-08-11 11:36:16+00:00)
Title: Convert resource_owner_id to resource_owner_uid

This PR allows the user to specify the property that will be used as the `resource_owner_uid`. By default this was the resource_owner.id property but when multiple user models from different databases are used, this can result in conflicts. This PR solves this by letting the user decide which property to use as the unique identifier of the resource owner.

For example with two different user models this can be a secure random hex that garanties uniqueness over two different tables (Admin and Users).

In the initialiser the `resource_owner_property` defaults to `:id` but can be changes to any property on the resource_owner object (for example `:uid`). This makes sure there are no braking changes with previous versions/implementations.

The code is also change to reflect this, in different places `resource_owner.id` was called, this is being changed to either `resource_owner` (lower level methods that then extract the correct property to be used as `resource_owner_uid`) or `resource_owner.send(Doorkeeper.configure.resource_owner_property)`.

At the moment all the specs pass on ruby 2.1.2 with rails 3.2.8/3.2.19/4.1.4 for active_record, mongoid2, mongoid3 and mongoid4. A new command parameter is added called `resource_owner_property` so all the specs can be run with either the default `:id` property or `:uid` property.

**I still need some help with mongo_mapper, I don't have any experience and the specs are failing so if anybody can help, that would be awesome!**