Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/FlaskAPI' into FlaskAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBrito13 committed Apr 27, 2020
2 parents 2379bba + e232aa2 commit 16529bb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
Binary file modified FlaskAPI/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file modified FlaskAPI/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file modified FlaskAPI/__pycache__/views.cpython-36.pyc
Binary file not shown.
15 changes: 2 additions & 13 deletions FlaskAPI/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,8 @@

SQLALCHEMY_TRACK_MODIFICATONS = False

CERT = b"""-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnzyis1ZjfNB0bBgKFMSv
vkTtwlvBsaJq7S5wA+kzeVOVpVWwkWdVha4s38XM/pa/yr47av7+z3VTmvDRyAHc
aT92whREFpLv9cj5lTeJSibyr/Mrm/YtjCZVWgaOYIhwrXwKLqPr/11inWsAkfIy
tvHWTxZYEcXLgAXFuUuaS3uF9gEiNQwzGTU1v0FqkqTBr4B8nW3HCN47XUu0t8Y0
e+lf4s4OxQawWD79J9/5d3Ry0vbV3Am1FtGJiJvOwRsIfVChDpYStTcHTCMqtvWb
V6L11BWkpzGXSW4Hv43qa+GSYOD2QU68Mb59oSk2OB+BtOLpJofmbGEGgvmwyCI9
MwIDAQAB
-----END PUBLIC KEY-----
"""

"""


CERT = b'-----BEGIN PUBLIC KEY-----\n' \
b'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlc6LMgsz5b2m2Q3M/ps2\n' \
b'XRKIuBRdwOUrY532F9OmkYrrdPsVpDpWTjRsc3Srrc9hUCIWNMQa++Cjq4yMFTHl\n' \
Expand All @@ -42,7 +32,6 @@
b'JwIDAQAB\n' \
b'-----END PUBLIC KEY-----'

"""
# JWT Decode Algorithm
JWT_SECRET_KEY = CERT

Expand Down
4 changes: 3 additions & 1 deletion FlaskAPI/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

# BASE Functions
def get_user_by_email(email):
print("\n\n\nEMAIL", email)
users_query = db.session().query(Profile).filter(Profile.email == email).one()
return users_query.serializable

Expand Down Expand Up @@ -171,13 +172,14 @@ class ExperienceView(Resource):
def get(self):
parse_data = parser.parse_args()
jwt_data = get_raw_jwt()
print("\n\n\n JWT ", jwt_data)
experiences_query = db.session.query(Experience, Profile)
# Apply filters
if jwt_data['isAdmin']:
if parse_data['userID']:
experiences_query = experiences_query.filter(Experience.profile == parse_data['userID'])
else:
email = parse_data['email']
email = jwt_data['email']
user_id = get_user_by_email(email)['id']
experiences_query = experiences_query.filter(Experience.profile == user_id)

Expand Down

0 comments on commit 16529bb

Please sign in to comment.