Skip to content

Commit

Permalink
[DVRL-10] Add auth_middleware to history route (#7540)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson authored Feb 9, 2024
1 parent edb21ea commit 79fa06c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/discovery-provider/src/api/v1/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,11 +1003,14 @@ def get(self, id):
@full_ns.route(USER_HISTORY_TRACKS_ROUTE)
class TrackHistoryFull(Resource):
@record_metrics
@auth_middleware()
@cache(ttl_sec=5)
def _get(self, id):
def _get(self, id, authed_user_id):
args = track_history_parser.parse_args()
decoded_id = decode_with_abort(id, ns)
current_user_id = get_current_user_id(args)
if not current_user_id and decoded_id == authed_user_id:
current_user_id = authed_user_id
offset = format_offset(args)
limit = format_limit(args)
query = format_query(args)
Expand Down Expand Up @@ -1048,8 +1051,9 @@ class TrackHistory(TrackHistoryFull):
)
@ns.expect(track_history_parser)
@ns.marshal_with(history_response)
def get(self, id):
return super()._get(id)
@auth_middleware()
def get(self, id, authed_user_id):
return super()._get(id, authed_user_id)


user_search_result = make_response(
Expand Down

0 comments on commit 79fa06c

Please sign in to comment.