Corp/backend/api/v1/tasks/permissions.py

18 lines
700 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Permission policies for the tasks HTTP API."""
from rest_framework.permissions import BasePermission
class CanAccessTaskAutomationAPI(BasePermission):
"""Preserve the current shared-rules policy behind an explicit boundary.
Fine-grained board and task access is enforced by the application use case.
Keeping the HTTP-level policy named makes a future role split local instead
of scattering authentication checks across view actions.
"""
message = "Для работы с автоматизациями требуется авторизация."
def has_permission(self, request, view) -> bool:
return bool(request.user and request.user.is_authenticated)