Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin scope doesn't analyze user's role #63

Open
texpert opened this issue Aug 5, 2016 · 2 comments
Open

admin scope doesn't analyze user's role #63

texpert opened this issue Aug 5, 2016 · 2 comments

Comments

@texpert
Copy link
Contributor

texpert commented Aug 5, 2016

When setting oauth2 'admin' scope, only the access_token scope is analyzed, returning error if the 'admin' scope is missing.

Woluld be better to, also, analyze user's role. Didn't quite get how to use Doorkeeper's admin_authenticator option from initializer, so just changed your method like this and it works:

def valid_doorkeeper_token?(*scopes) doorkeeper_token && doorkeeper_token.accessible? && (doorkeeper_token.includes_scope(*scopes) || User.find(doorkeeper_token.resource_owner_id).admin?) end

@texpert
Copy link
Contributor Author

texpert commented Aug 9, 2016

Made a PR using Doorkeepers authenticate_admin - #64

@antek-drzewiecki
Copy link
Owner

Ill look into it today! :) thanks for the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants