FitTrackee/fittrackee/workouts/utils/visibility.py
2022-02-16 18:07:17 +01:00

15 lines
371 B
Python

from typing import Optional
from fittrackee.responses import ForbiddenErrorResponse, HttpResponse
def can_view_workout(
auth_user_id: int, workout_user_id: int
) -> Optional[HttpResponse]:
"""
Return error response if user has no right to view workout
"""
if auth_user_id != workout_user_id:
return ForbiddenErrorResponse()
return None