mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix: link new object_permission_id back to team on first MCP server create
When a team has no object_permission_id yet, the auto-assign logic creates an ObjectPermissionTable row but never linked it to the team. Now updates the team's object_permission_id after creation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f4e5fb2b4a
commit
6c06e6dc80
1 changed files with 8 additions and 1 deletions
|
|
@ -1358,7 +1358,7 @@ if MCP_AVAILABLE:
|
|||
set(existing_mcp_servers + [new_mcp_server.server_id])
|
||||
)
|
||||
|
||||
await handle_update_object_permission_common(
|
||||
new_permission_id = await handle_update_object_permission_common(
|
||||
data_json={
|
||||
"object_permission": {
|
||||
"mcp_servers": updated_mcp_servers,
|
||||
|
|
@ -1367,6 +1367,13 @@ if MCP_AVAILABLE:
|
|||
existing_object_permission_id=existing_permission_id,
|
||||
prisma_client=prisma_client,
|
||||
)
|
||||
|
||||
# If the team had no object_permission_id, link the new one
|
||||
if existing_permission_id is None and new_permission_id is not None:
|
||||
await prisma_client.db.litellm_teamtable.update(
|
||||
where={"team_id": manager_team_id},
|
||||
data={"object_permission_id": new_permission_id},
|
||||
)
|
||||
except Exception as e:
|
||||
verbose_proxy_logger.exception(f"Error creating mcp server: {str(e)}")
|
||||
raise HTTPException(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue