Skip to content

Commit da3bc56

Browse files
committed
address at route level
1 parent bd35758 commit da3bc56

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • apps/sim/app/api/organizations/[id]/permission-groups/[groupId]

apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/route.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ export const PUT = withRouteHandler(
128128
? false
129129
: group.appliesToAllWorkspaces
130130

131+
const effectiveIsDefault =
132+
updates.isDefault !== undefined ? updates.isDefault : group.isDefault
133+
if (effectiveIsDefault && !resolvedAppliesToAll) {
134+
return NextResponse.json(
135+
{ error: 'The default group must apply to all workspaces' },
136+
{ status: 400 }
137+
)
138+
}
139+
131140
// Resolve and validate explicitly-provided workspaceIds before the
132141
// transaction. When the request omits them for a specific-scope group
133142
// ("keep current"), they're read under the lock instead (see below) so the

0 commit comments

Comments
 (0)