nexus-5/core/permissions.py
2026-01-26 11:09:40 -05:00

14 lines
447 B
Python

"""
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