diff --git a/omni_pro_oms/permissions.py b/omni_pro_oms/permissions.py index b34c458..8fa865b 100644 --- a/omni_pro_oms/permissions.py +++ b/omni_pro_oms/permissions.py @@ -15,4 +15,11 @@ def has_permission(self, request, view): response = requests.get(url, headers=headers) return response.status_code == 200 + token = request.headers.get("token", None) + if token: + url = settings.AUTH_BASE_URL + "/auth/user/validate/" + headers = {"Authorization": f"Token {token}"} + response = requests.get(url, headers=headers) + return response.status_code == 200 + return False