Skip to content

Implement basic user roles functionality#94

Merged
peacheym merged 11 commits into
masterfrom
implement-user-roles
Feb 14, 2020
Merged

Implement basic user roles functionality#94
peacheym merged 11 commits into
masterfrom
implement-user-roles

Conversation

@peacheym

Copy link
Copy Markdown
Contributor

Adds basic user role functionality

This PR's largest role is to enable pulling from the user_role column from the Users table in the database and adding it to the user_claims dictionary 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_auth decorators.

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
@peacheym peacheym requested a review from nsdeschenes February 13, 2020 16:30
Comment thread api/manage.py

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}'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering why you added the port, the system will automatically go for the correct port?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@peacheym peacheym merged commit 4766a7a into master Feb 14, 2020
@peacheym peacheym deleted the implement-user-roles branch February 14, 2020 13:35
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

Successfully merging this pull request may close these issues.

2 participants