{"action":"created","issue":{"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/1069","repository_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper","labels_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/1069/labels{/name}","comments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/1069/comments","events_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/1069/events","html_url":"https://github.com/doorkeeper-gem/doorkeeper/issues/1069","id":310761148,"node_id":"MDU6SXNzdWUzMTA3NjExNDg=","number":1069,"title":"Polymorphic user model associations","user":{"login":"milgner","id":160025,"node_id":"MDQ6VXNlcjE2MDAyNQ==","avatar_url":"https://avatars0.githubusercontent.com/u/160025?v=4","gravatar_id":"","url":"https://api.github.com/users/milgner","html_url":"https://github.com/milgner","followers_url":"https://api.github.com/users/milgner/followers","following_url":"https://api.github.com/users/milgner/following{/other_user}","gists_url":"https://api.github.com/users/milgner/gists{/gist_id}","starred_url":"https://api.github.com/users/milgner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milgner/subscriptions","organizations_url":"https://api.github.com/users/milgner/orgs","repos_url":"https://api.github.com/users/milgner/repos","events_url":"https://api.github.com/users/milgner/events{/privacy}","received_events_url":"https://api.github.com/users/milgner/received_events","type":"User","site_admin":false},"labels":[{"id":818242476,"node_id":"MDU6TGFiZWw4MTgyNDI0NzY=","url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/labels/enhancement","name":"enhancement","color":"8bf73d","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/milestones/8","html_url":"https://github.com/doorkeeper-gem/doorkeeper/milestone/8","labels_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/milestones/8/labels","id":3265654,"node_id":"MDk6TWlsZXN0b25lMzI2NTY1NA==","number":8,"title":"5.1","description":"","creator":{"login":"nbulaj","id":1443426,"node_id":"MDQ6VXNlcjE0NDM0MjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1443426?v=4","gravatar_id":"","url":"https://api.github.com/users/nbulaj","html_url":"https://github.com/nbulaj","followers_url":"https://api.github.com/users/nbulaj/followers","following_url":"https://api.github.com/users/nbulaj/following{/other_user}","gists_url":"https://api.github.com/users/nbulaj/gists{/gist_id}","starred_url":"https://api.github.com/users/nbulaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbulaj/subscriptions","organizations_url":"https://api.github.com/users/nbulaj/orgs","repos_url":"https://api.github.com/users/nbulaj/repos","events_url":"https://api.github.com/users/nbulaj/events{/privacy}","received_events_url":"https://api.github.com/users/nbulaj/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2018-04-13T12:42:50Z","updated_at":"2018-04-13T12:43:37Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2018-04-03T09:32:28Z","updated_at":"2018-06-22T08:23:16Z","closed_at":null,"author_association":"NONE","body":"Just like in this [this SO question](https://stackoverflow.com/questions/25834404/doorkeeper-resource-owner-credential-flow-for-multiple-models), I'm using doorkeeper scopes to hand out access tokens for multiple models.\r\n\r\nThe problem with the accepted answer there is that doorkeeper doesn't persist the information of the model on the token, causing problems with scoping of the `resource_owner_id` column in methods like [`AccessToken.revoke_all_for`](https://github.com/doorkeeper-gem/doorkeeper/blob/master/lib/doorkeeper/models/access_token_mixin.rb#L47).\r\n\r\nAre there any plans to support a polymorphic user model association within doorkeeper? Would you accept a pull request towards to accomplish this? My plan would be to just add a `resource_owner_type` column, adapt the access token mixin and set `polymorphic: true` on the ActiveRecord association. I'd need to investigate the other ORM integrations separately on how to accomplish this but I assume that they have similar features."},"comment":{"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/comments/399363423","html_url":"https://github.com/doorkeeper-gem/doorkeeper/issues/1069#issuecomment-399363423","issue_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/1069","id":399363423,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTM2MzQyMw==","user":{"login":"nbulaj","id":1443426,"node_id":"MDQ6VXNlcjE0NDM0MjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1443426?v=4","gravatar_id":"","url":"https://api.github.com/users/nbulaj","html_url":"https://github.com/nbulaj","followers_url":"https://api.github.com/users/nbulaj/followers","following_url":"https://api.github.com/users/nbulaj/following{/other_user}","gists_url":"https://api.github.com/users/nbulaj/gists{/gist_id}","starred_url":"https://api.github.com/users/nbulaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbulaj/subscriptions","organizations_url":"https://api.github.com/users/nbulaj/orgs","repos_url":"https://api.github.com/users/nbulaj/repos","events_url":"https://api.github.com/users/nbulaj/events{/privacy}","received_events_url":"https://api.github.com/users/nbulaj/received_events","type":"User","site_admin":false},"created_at":"2018-06-22T08:23:16Z","updated_at":"2018-06-22T08:23:16Z","author_association":"MEMBER","body":"> My plan would be to just add a resource_owner_type column, adapt the access token mixin and set polymorphic: true on the ActiveRecord association. I'd need to investigate the other ORM integrations separately on how to accomplish this but I assume that they have similar features.\r\n\r\nIt's not so simple as many parts of the Doorkeeper are tied to Resource Owner. I've [created a branch](https://github.com/doorkeeper-gem/doorkeeper/tree/polymorphic_resource_owner) with some stubs for polymorphic Resource Owner, currently it has broken test suite and requires some changes. This implementation couldn't be merged to master because of incompatibility issues with old versions of Doorkeeper. So if such feature ever would be released, it requires to be compatible with old versions of the gem."}}
{"actor":{"display_login":"nbulaj"}}