fix: database-delete.action.ts

This commit is contained in:
charles-gauthereau
2026-07-05 18:31:52 +02:00
parent df692c4729
commit 6d19fb8833
@@ -60,9 +60,7 @@ async function assertCanDeleteDatabase(databaseId: string): Promise<void> {
const canManage = activeMember
? computeOrganizationPermissions(activeMember).canManageAgents
: false;
// Only the organization that CREATED the agent may delete its databases.
// A system agent merely attributed to an org via the join table is
// handled by the isAdmin branch above (agent.organizationId === null).
const hasAccess =
!!organization && agent.organizationId === organization.id;
authorized = canManage && hasAccess;