""" Custom permissions for Ory-based authentication. """ from rest_framework.permissions import BasePermission class IsProfileAuthenticated(BasePermission): """ Permission that checks if the request has an authenticated profile from Ory. Requires OryHeaderAuthenticationMiddleware to set request.profile. """ def has_permission(self, request, view): return hasattr(request, 'profile') and request.profile is not None