Skip to content

Adding Flask_pyoidc and Updating to Python 3.6 #169

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

Merged
merged 5 commits into from
Mar 6, 2018

Conversation

devinmatte
Copy link
Member

@devinmatte devinmatte commented Mar 3, 2018

Added flask_oidc

This removes the need for the overarching oidc that causes timeout issues.

I updated to Python 3.6 in order to get that package to work properly, as well as prepare to upgrade ldap in the coming week

Should fix #90

Copy link
Member

@liam-middlebrook liam-middlebrook left a comment

Choose a reason for hiding this comment

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

Overall I think that the structure after your changes are applied is an improvement.

I've left quite a few comments on places where changes under the "Adding flask_pyoidc" commit d214bdf could be moved to a style (or cosmetic) change commit.

Keeping cosmetic changes separate from functional changes allows for easier reviewing and bisecting of commits.

from flask import Flask, redirect, request, render_template, g
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate

Copy link
Member

Choose a reason for hiding this comment

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

Move to the style fixes commit.

Also why is this being reordered (and some lines being deleted)?

Copy link
Member Author

@devinmatte devinmatte Mar 3, 2018

Choose a reason for hiding this comment

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

Based on: https://www.python.org/dev/peps/pep-0008/#imports
The lines being deleted are unused imports

Copy link
Member

Choose a reason for hiding this comment

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

Then that should be a separate commit from adding pyoidc support.

# pylint: disable=C0413
from conditional.models.models import UserLog


Copy link
Member

Choose a reason for hiding this comment

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

Move to style fixes commit.

# Configure Logging
def request_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name
def request_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name
Copy link
Member

Choose a reason for hiding this comment

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

Move to style fixes commit.

@@ -52,7 +58,7 @@ def request_processor(logger, log_method, event_dict): # pylint: disable=unused-
return event_dict


def database_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name
def database_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name
Copy link
Member

Choose a reason for hiding this comment

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

Move to style fixes commit.


from conditional.blueprints.dashboard import dashboard_bp # pylint: disable=ungrouped-imports
from conditional.blueprints.dashboard import dashboard_bp # pylint: disable=ungrouped-imports
Copy link
Member

Choose a reason for hiding this comment

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

Move to style fixes commit.

from flask import Blueprint, request, jsonify

from conditional import db, auth
Copy link
Member

Choose a reason for hiding this comment

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

Move to style fixes commit.

from conditional.util.ldap import ldap_get_intro_members

from conditional.models.models import FreshmanCommitteeAttendance
from conditional import start_of_year, auth
Copy link
Member

Choose a reason for hiding this comment

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

Move to style fixes commit.

from flask import Blueprint, request

from conditional import auth
Copy link
Member

Choose a reason for hiding this comment

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

Move to style fixes commit.


from conditional import db

from conditional.util.auth import get_username
Copy link
Member

Choose a reason for hiding this comment

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

Move to style fixes commit.

from conditional.models.models import HouseMeeting
from conditional.models.models import MajorProject
Copy link
Member

Choose a reason for hiding this comment

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

Move to style fixes commit.

Copy link
Member

@mbillow mbillow left a comment

Choose a reason for hiding this comment

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

Thanks for putting in this work! Just a few things I think could be moved around or fixed.

@@ -24,3 +26,13 @@ def wrapped_func(*args, **kwargs):
"is_eval": is_eval}, *args, **kwargs)

return wrapped_func


def get_username(func):
Copy link
Member

Choose a reason for hiding this comment

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

Just a thought: Almost every time we use this wrapper we immediately grab their LDAP object, why not just do that in the wrapper and return the user object?


# TODO maybe use the webauth request decorator
@get_username
def render_template(template_name, username=None, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

See my previous comment. We should just include this in the wrapper and then we don't have to worry about it.

@@ -25,5 +26,15 @@
SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(os.path.join(os.getcwd(), "data.db"))
ZOO_DATABASE_URI = 'mysql+pymysql://user:pass@host/database'

# OIDC Config
Copy link
Member

Choose a reason for hiding this comment

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

Please also add some relevant info to the README in the setup instruction section.

@devinmatte devinmatte force-pushed the oidc branch 4 times, most recently from 42ef6df to 317cd95 Compare March 4, 2018 02:44
@devinmatte
Copy link
Member Author

Addressed the comments left by @mbillow

@mbillow mbillow dismissed liam-middlebrook’s stale review March 5, 2018 03:03

Honestly, I don't think that a separate style commit is necessary. It doesn't net us any real benefits.

Copy link
Collaborator

@stevenmirabito stevenmirabito left a comment

Choose a reason for hiding this comment

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

🚢 🎉

@stevenmirabito stevenmirabito merged commit 54c27fb into ComputerScienceHouse:develop Mar 6, 2018
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.

Migrate to OpenID Connect Authentication
4 participants