2025-04-20 16:34:29 -07:00
|
|
|
from enum import Enum
|
2024-11-22 18:56:22 -05:00
|
|
|
from typing import Optional, Set
|
2025-04-20 16:34:29 -07:00
|
|
|
|
2024-11-22 18:56:22 -05:00
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
class EntityType(str, Enum):
|
|
|
|
USER = "user"
|
|
|
|
DEVELOPER = "developer"
|
|
|
|
|
|
|
|
|
|
|
|
class AuthContext(BaseModel):
|
|
|
|
"""JWT decoded context"""
|
2024-12-26 11:34:24 -05:00
|
|
|
|
2024-11-22 18:56:22 -05:00
|
|
|
entity_type: EntityType
|
|
|
|
entity_id: str # uuid
|
|
|
|
app_id: Optional[str] = None # uuid, only for developers
|
2024-12-15 14:31:25 -05:00
|
|
|
# TODO: remove permissions, not required here.
|
2024-11-22 18:56:22 -05:00
|
|
|
permissions: Set[str] = {"read"}
|
2025-03-27 17:30:02 -07:00
|
|
|
user_id: Optional[str] = None # ID of the user who owns the app/entity
|