Skip to content

Commit

Permalink
Bump flask jwt extended version to 4.0.2 #1002
Browse files Browse the repository at this point in the history
Signed-off-by: epicadk <[email protected]>
  • Loading branch information
epicadk committed Feb 17, 2021
1 parent 1765e56 commit 429fd4f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/api/jwt_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


@jwt.expired_token_loader
def my_expired_token_callback():
def my_expired_token_callback(jwt_header, jwt_payload):
return messages.TOKEN_HAS_EXPIRED, HTTPStatus.UNAUTHORIZED


Expand Down
6 changes: 3 additions & 3 deletions app/api/resources/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@admin_ns.response(HTTPStatus.NOT_FOUND.value, f"{messages.USER_DOES_NOT_EXIST}")
class AssignNewUserAdmin(Resource):
@classmethod
@jwt_required
@jwt_required()
@admin_ns.expect(
auth_header_parser, assign_and_revoke_user_admin_request_body, validate=True
)
Expand Down Expand Up @@ -55,7 +55,7 @@ def post(cls):
@admin_ns.response(HTTPStatus.NOT_FOUND.value, f"{messages.USER_DOES_NOT_EXIST}")
class RevokeUserAdmin(Resource):
@classmethod
@jwt_required
@jwt_required()
@admin_ns.expect(
auth_header_parser, assign_and_revoke_user_admin_request_body, validate=True
)
Expand All @@ -79,7 +79,7 @@ def post(cls):
@admin_ns.route("admins")
class ListAdmins(Resource):
@classmethod
@jwt_required
@jwt_required()
@admin_ns.doc("get_list_of_admins")
@admin_ns.response(HTTPStatus.OK.value, "Success.", public_admin_user_api_model)
@admin_ns.doc(
Expand Down
18 changes: 9 additions & 9 deletions app/api/resources/mentorship_relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@mentorship_relation_ns.route("mentorship_relation/send_request")
class SendRequest(Resource):
@classmethod
@jwt_required
@jwt_required()
@mentorship_relation_ns.doc("send_request")
@mentorship_relation_ns.expect(auth_header_parser, send_mentorship_request_body)
@mentorship_relation_ns.response(
Expand Down Expand Up @@ -122,7 +122,7 @@ def is_valid_data(data):
@mentorship_relation_ns.route("mentorship_relations")
class GetAllMyMentorshipRelation(Resource):
@classmethod
@jwt_required
@jwt_required()
@mentorship_relation_ns.doc("get_all_user_mentorship_relations")
@mentorship_relation_ns.expect(auth_header_parser)
@mentorship_relation_ns.param(
Expand Down Expand Up @@ -174,7 +174,7 @@ def get(cls):
@mentorship_relation_ns.route("mentorship_relation/<int:request_id>/accept")
class AcceptMentorshipRelation(Resource):
@classmethod
@jwt_required
@jwt_required()
@mentorship_relation_ns.doc("accept_mentorship_relation")
@mentorship_relation_ns.expect(auth_header_parser)
@mentorship_relation_ns.response(
Expand Down Expand Up @@ -223,7 +223,7 @@ def put(cls, request_id):
@mentorship_relation_ns.route("mentorship_relation/<int:request_id>/reject")
class RejectMentorshipRelation(Resource):
@classmethod
@jwt_required
@jwt_required()
@mentorship_relation_ns.doc("reject_mentorship_relation")
@mentorship_relation_ns.expect(auth_header_parser)
@mentorship_relation_ns.response(
Expand Down Expand Up @@ -267,7 +267,7 @@ def put(cls, request_id):
@mentorship_relation_ns.route("mentorship_relation/<int:request_id>/cancel")
class CancelMentorshipRelation(Resource):
@classmethod
@jwt_required
@jwt_required()
@mentorship_relation_ns.doc("cancel_mentorship_relation")
@mentorship_relation_ns.expect(auth_header_parser)
@mentorship_relation_ns.response(
Expand Down Expand Up @@ -310,7 +310,7 @@ def put(cls, request_id):
@mentorship_relation_ns.route("mentorship_relation/<int:request_id>")
class DeleteMentorshipRelation(Resource):
@classmethod
@jwt_required
@jwt_required()
@mentorship_relation_ns.doc("delete_mentorship_relation")
@mentorship_relation_ns.expect(auth_header_parser)
@mentorship_relation_ns.response(
Expand Down Expand Up @@ -353,7 +353,7 @@ def delete(cls, request_id):
@mentorship_relation_ns.route("mentorship_relations/past")
class ListPastMentorshipRelations(Resource):
@classmethod
@jwt_required
@jwt_required()
@mentorship_relation_ns.doc("get_past_mentorship_relations")
@mentorship_relation_ns.expect(auth_header_parser)
@mentorship_relation_ns.response(
Expand Down Expand Up @@ -392,7 +392,7 @@ def get(cls):
@mentorship_relation_ns.route("mentorship_relations/current")
class ListCurrentMentorshipRelation(Resource):
@classmethod
@jwt_required
@jwt_required()
@mentorship_relation_ns.doc("get_current_mentorship_relation")
@mentorship_relation_ns.expect(auth_header_parser)
@mentorship_relation_ns.response(
Expand Down Expand Up @@ -432,7 +432,7 @@ def get(cls):
@mentorship_relation_ns.route("mentorship_relations/pending")
class ListPendingMentorshipRequests(Resource):
@classmethod
@jwt_required
@jwt_required()
@mentorship_relation_ns.doc("get_pending_mentorship_relations")
@mentorship_relation_ns.expect(auth_header_parser)
@mentorship_relation_ns.response(
Expand Down
8 changes: 4 additions & 4 deletions app/api/resources/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@task_ns.route("mentorship_relation/<int:request_id>/task")
class CreateTask(Resource):
@classmethod
@jwt_required
@jwt_required()
@task_ns.doc("create_task_in_mentorship_relation")
@task_ns.expect(auth_header_parser, create_task_request_body)
@task_ns.response(HTTPStatus.CREATED, f"{messages.TASK_WAS_CREATED_SUCCESSFULLY}")
Expand Down Expand Up @@ -75,7 +75,7 @@ def is_valid_data(data):
@task_ns.route("mentorship_relation/<int:request_id>/task/<int:task_id>")
class DeleteTask(Resource):
@classmethod
@jwt_required
@jwt_required()
@task_ns.doc("delete_task_in_mentorship_relation")
@task_ns.expect(auth_header_parser)
@task_ns.response(HTTPStatus.OK, f"{messages.TASK_WAS_DELETED_SUCCESSFULLY}")
Expand Down Expand Up @@ -119,7 +119,7 @@ def delete(cls, request_id, task_id):
@task_ns.route("mentorship_relation/<int:request_id>/tasks")
class ListTasks(Resource):
@classmethod
@jwt_required
@jwt_required()
@task_ns.doc("list_tasks_in_mentorship_relation")
@task_ns.expect(auth_header_parser)
@task_ns.response(
Expand Down Expand Up @@ -167,7 +167,7 @@ def get(cls, request_id):
@task_ns.route("mentorship_relation/<int:request_id>/task/<int:task_id>/complete")
class UpdateTask(Resource):
@classmethod
@jwt_required
@jwt_required()
@task_ns.doc("update_task_in_mentorship_relation")
@task_ns.expect(auth_header_parser)
@task_ns.response(HTTPStatus.OK, f"{messages.TASK_WAS_ACHIEVED_SUCCESSFULLY}")
Expand Down
8 changes: 4 additions & 4 deletions app/api/resources/task_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)
class CreateTaskComment(Resource):
@classmethod
@jwt_required
@jwt_required()
@task_comment_ns.expect(auth_header_parser, task_comment_model)
@task_comment_ns.doc(
responses={
Expand Down Expand Up @@ -61,7 +61,7 @@ def post(cls, relation_id, task_id):
)
class TaskComment(Resource):
@classmethod
@jwt_required
@jwt_required()
@task_comment_ns.expect(auth_header_parser, task_comment_model)
@task_comment_ns.doc(
responses={
Expand Down Expand Up @@ -99,7 +99,7 @@ def put(cls, relation_id, task_id, comment_id):
)

@classmethod
@jwt_required
@jwt_required()
@task_comment_ns.expect(auth_header_parser)
@task_comment_ns.doc(
responses={
Expand Down Expand Up @@ -132,7 +132,7 @@ def delete(cls, relation_id, task_id, comment_id):
)
class TaskComments(Resource):
@classmethod
@jwt_required
@jwt_required()
@task_comment_ns.expect(auth_header_parser)
@task_comment_ns.response(
HTTPStatus.OK,
Expand Down
21 changes: 10 additions & 11 deletions app/api/resources/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from flask import request
from flask_jwt_extended import (
jwt_required,
jwt_refresh_token_required,
create_access_token,
create_refresh_token,
get_jwt_identity,
Expand Down Expand Up @@ -36,7 +35,7 @@
# TODO: @users_ns.response(404, 'User does not exist.')
class UserList(Resource):
@classmethod
@jwt_required
@jwt_required()
@users_ns.doc(
"list_users",
params={
Expand Down Expand Up @@ -80,7 +79,7 @@ def get(cls):
@users_ns.param("user_id", "The user identifier")
class OtherUser(Resource):
@classmethod
@jwt_required
@jwt_required()
@users_ns.doc("get_user")
@users_ns.expect(auth_header_parser)
@users_ns.response(HTTPStatus.OK.value, "Success.", public_user_api_model)
Expand Down Expand Up @@ -121,7 +120,7 @@ def get(cls, user_id):
@users_ns.response(HTTPStatus.NOT_FOUND.value, "%s" % messages.USER_DOES_NOT_EXIST)
class MyUserProfile(Resource):
@classmethod
@jwt_required
@jwt_required()
@users_ns.doc("get_user")
@users_ns.expect(auth_header_parser, validate=True)
@users_ns.marshal_with(
Expand All @@ -138,7 +137,7 @@ def get(cls):
return DAO.get_user(user_id)

@classmethod
@jwt_required
@jwt_required()
@users_ns.doc("update_user_profile")
@users_ns.expect(auth_header_parser, update_user_request_body_model)
@users_ns.response(HTTPStatus.OK.value, "%s" % messages.USER_SUCCESSFULLY_UPDATED)
Expand Down Expand Up @@ -174,7 +173,7 @@ def put(cls):
return DAO.update_user_profile(user_id, data)

@classmethod
@jwt_required
@jwt_required()
@users_ns.doc("delete_user")
@users_ns.expect(auth_header_parser, validate=True)
@users_ns.response(HTTPStatus.OK.value, "%s" % messages.USER_SUCCESSFULLY_DELETED)
Expand Down Expand Up @@ -209,7 +208,7 @@ def delete(cls):
@users_ns.route("user/change_password")
class ChangeUserPassword(Resource):
@classmethod
@jwt_required
@jwt_required()
@users_ns.doc("update_user_password")
@users_ns.expect(
auth_header_parser, change_password_request_data_model, validate=True
Expand Down Expand Up @@ -242,7 +241,7 @@ def put(cls):
@users_ns.route("users/verified")
class VerifiedUser(Resource):
@classmethod
@jwt_required
@jwt_required()
@users_ns.doc(
"get_verified_users",
params={
Expand Down Expand Up @@ -410,7 +409,7 @@ def post(cls):
@users_ns.route("refresh")
class RefreshUser(Resource):
@classmethod
@jwt_refresh_token_required
@jwt_required(refresh=True)
@users_ns.doc("refresh")
@users_ns.response(
HTTPStatus.OK.value, "Successful refresh", refresh_response_body_model
Expand Down Expand Up @@ -536,7 +535,7 @@ def post(cls):
@users_ns.response(HTTPStatus.NOT_FOUND.value, "%s" % messages.USER_NOT_FOUND)
class UserHomeStatistics(Resource):
@classmethod
@jwt_required
@jwt_required()
@users_ns.expect(auth_header_parser)
def get(cls):
"""Get Statistics regarding the current user
Expand All @@ -561,7 +560,7 @@ def get(cls):
@users_ns.response(HTTPStatus.NOT_FOUND.value, "User not found")
class UserDashboard(Resource):
@classmethod
@jwt_required
@jwt_required()
@users_ns.expect(auth_header_parser)
def get(cls):
"""Get current User's dashboard
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APScheduler==3.6.3
coverage==5.3
Flask==1.0.2
Flask-JWT-Extended==3.25.0
Flask-JWT-Extended==4.0.2
Flask-Mail==0.9.1
Flask-Migrate==2.5.3
flask-restx==0.2.0
Expand Down

0 comments on commit 429fd4f

Please sign in to comment.