Implement basic user roles functionality#94
Merged
Conversation
Currently a String, may switch to different type.
Testable through the graphql using the dummy resolver that is protected.
Add update_role function for admin use. Todo: Test to ensure that mutations/queries are protected
nsdeschenes
suggested changes
Feb 14, 2020
|
|
||
| app = Flask(__name__) | ||
| app.config['SQLALCHEMY_DATABASE_URI'] = f'postgresql+psycopg2://{DB_USER}:{DB_PASS}@{DB_HOST}/{DB_NAME}' | ||
| app.config['SQLALCHEMY_DATABASE_URI'] = f'postgresql+psycopg2://{DB_USER}:{DB_PASS}@{DB_HOST}:{DB_PORT}/{DB_NAME}' |
Contributor
There was a problem hiding this comment.
Just wondering why you added the port, the system will automatically go for the correct port?
Contributor
Author
There was a problem hiding this comment.
I added it because I used a non-default port for my local postgres instance. This is to avoid all conflicts between my local and my cloud-build-local. Plus, were passing it in as an ENV so we may as well use it? Unless of course it will break something to do with migrate?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds basic user role functionality
This PR's largest role is to enable pulling from the
user_rolecolumn from the Users table in the database and adding it to theuser_claimsdictionary when signing in a user.Additions
Adds a
update_role()function that allows an admin to update the role of a user.Adds a
test_user_claims()function that allows you to hit the API and see what a user's role is.Both of the above additions are protected by the
flask_graphql_authdecorators.