-
Notifications
You must be signed in to change notification settings - Fork 9
feat(organizations): Enterprise groups with composable model-access policies #4891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
18efe32
feat(organizations): Enterprise groups with composable policies
jrf0110 295d1e6
fix(organizations): address groups PR review
jrf0110 8838610
fix(organizations): flag MCP server access policy as not yet enforced
jrf0110 04b3010
fix(organizations): evaluate defaults policy against the authorized o…
jrf0110 de992cb
test(ai-gateway): use a second serving provider in the BYOK ignore fi…
jrf0110 444706c
chore: move Enterprise groups plan docs out of the repo
jrf0110 96ebdfc
feat(organizations): drop the MCP server access policy
jrf0110 b7bd102
fix(organizations): stop 500ing organization defaults for authorized …
jrf0110 1624c27
fix(organizations): resolve org-level policy for non-member admin rea…
jrf0110 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { redirect } from 'next/navigation'; | ||
| import { OrganizationByPageLayout } from '@/components/organizations/OrganizationByPageLayout'; | ||
| import { OrganizationGroupsPage } from '@/components/organizations/groups/OrganizationGroupsPage'; | ||
|
|
||
| export default async function GroupsPage({ params }: { params: Promise<{ id: string }> }) { | ||
| return ( | ||
| <OrganizationByPageLayout | ||
| params={params} | ||
| render={({ role, organization }) => { | ||
| if (organization.plan !== 'enterprise') redirect(`/organizations/${organization.id}`); | ||
| return <OrganizationGroupsPage organizationId={organization.id} role={role} />; | ||
| }} | ||
| /> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,44 @@ | ||
| import { NextResponse } from 'next/server'; | ||
| import { KILO_EMBEDDING_MODEL_CATALOG } from '@/lib/ai-gateway/embeddings/kilo-embedding-models'; | ||
| import { getUserFromAuth } from '@/lib/user/server'; | ||
| import { | ||
| getEffectiveModelDecision, | ||
| resolveOrganizationMemberModelPolicy, | ||
| } from '@/lib/organizations/effective-model-access.server'; | ||
|
|
||
| export async function GET(): Promise<NextResponse> { | ||
| const auth = await getUserFromAuth({ adminOnly: false }).catch(() => null); | ||
| if (auth?.organizationId && auth.user) { | ||
| // Resolve the member's policy once, then evaluate each catalog model | ||
| // against it — the policy context is a transaction + several queries. | ||
| const policy = await resolveOrganizationMemberModelPolicy({ | ||
| organizationId: auth.organizationId, | ||
| kiloUserId: auth.user.id, | ||
| }); | ||
| const models = []; | ||
| for (const model of KILO_EMBEDDING_MODEL_CATALOG.models) { | ||
| if ((await getEffectiveModelDecision(policy, model.id)).allowed) models.push(model); | ||
| } | ||
| if (models.length === 0) { | ||
| return NextResponse.json( | ||
| { error: 'No embedding models are available through your organization groups.' }, | ||
| { status: 409 } | ||
| ); | ||
| } | ||
| const modelIds = new Set(models.map(model => model.id)); | ||
| const aliases = Object.fromEntries( | ||
| Object.entries(KILO_EMBEDDING_MODEL_CATALOG.aliases).filter(([, modelId]) => | ||
| modelIds.has(modelId) | ||
| ) | ||
| ); | ||
| return NextResponse.json({ | ||
| ...KILO_EMBEDDING_MODEL_CATALOG, | ||
| defaultModel: modelIds.has(KILO_EMBEDDING_MODEL_CATALOG.defaultModel) | ||
| ? KILO_EMBEDDING_MODEL_CATALOG.defaultModel | ||
| : models[0].id, | ||
| models, | ||
| aliases, | ||
| }); | ||
| } | ||
| return NextResponse.json(KILO_EMBEDDING_MODEL_CATALOG); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.