Skip to content
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

Bump flask jwt extended version to 4.0.2 #1002 #1005

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/api/jwt_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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 @@ -29,7 +29,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 @@ -61,7 +61,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 @@ -85,7 +85,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,
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 @@ -32,7 +32,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 @@ -130,7 +130,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 @@ -182,7 +182,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 @@ -232,7 +232,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 @@ -277,7 +277,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 @@ -322,7 +322,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 @@ -366,7 +366,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 @@ -405,7 +405,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 @@ -445,7 +445,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 @@ -23,7 +23,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(
Expand Down Expand Up @@ -84,7 +84,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.value, f"{messages.TASK_WAS_DELETED_SUCCESSFULLY}")
Expand Down Expand Up @@ -128,7 +128,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 @@ -176,7 +176,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.value, 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 @@ -26,7 +26,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 @@ -66,7 +66,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 @@ -104,7 +104,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 @@ -137,7 +137,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.value,
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 @@ -5,7 +5,6 @@
create_access_token,
create_refresh_token,
get_jwt_identity,
jwt_refresh_token_required,
jwt_required,
)
from flask_restx import Namespace, Resource, marshal
Expand Down Expand Up @@ -51,7 +50,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 @@ -100,7 +99,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(
Expand Down Expand Up @@ -139,7 +138,7 @@ def get(cls, user_id):
@users_ns.response(HTTPStatus.NOT_FOUND.value, f"{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 @@ -156,7 +155,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, f"{messages.USER_SUCCESSFULLY_UPDATED}")
Expand Down Expand Up @@ -192,7 +191,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, f"{messages.USER_SUCCESSFULLY_DELETED}")
Expand Down Expand Up @@ -225,7 +224,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 @@ -255,7 +254,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 @@ -422,7 +421,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,
Expand Down Expand Up @@ -529,7 +528,7 @@ def post(cls):
@users_ns.response(HTTPStatus.NOT_FOUND.value, f"{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 @@ -556,7 +555,7 @@ def get(cls):
@users_ns.response(HTTPStatus.NOT_FOUND.value, f"{messages.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.7.0
coverage==5.5
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.5.0
Expand Down