fix(agent): expose network context
This commit is contained in:
@@ -20,6 +20,7 @@ class AgentAuthContextResponse(BaseModel):
|
||||
role: str
|
||||
is_superuser: bool
|
||||
project_id: str
|
||||
network: str
|
||||
project_role: str
|
||||
token_expires_at: str | None = None
|
||||
|
||||
@@ -43,6 +44,7 @@ async def get_agent_auth_context(
|
||||
role=current_user.role,
|
||||
is_superuser=current_user.is_superuser,
|
||||
project_id=str(ctx.project_id),
|
||||
network=ctx.project_code,
|
||||
project_role=ctx.project_role,
|
||||
token_expires_at=token_expires_at,
|
||||
)
|
||||
|
||||
@@ -25,6 +25,7 @@ logger = logging.getLogger(__name__)
|
||||
@dataclass(frozen=True)
|
||||
class ProjectContext:
|
||||
project_id: UUID
|
||||
project_code: str
|
||||
user_id: UUID
|
||||
project_role: str
|
||||
|
||||
@@ -85,6 +86,7 @@ async def get_project_context(
|
||||
|
||||
return ProjectContext(
|
||||
project_id=project.id,
|
||||
project_code=project.code,
|
||||
user_id=user.id,
|
||||
project_role=membership_role,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user