Skip to content

Commit c426fd4

Browse files
committed
feat(ee): access control, sso
1 parent 06d7ce7 commit c426fd4

File tree

21 files changed

+199
-19
lines changed

21 files changed

+199
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { hasAccessControlAccess } from '@/lib/billing'
99
import {
1010
type PermissionGroupConfig,
1111
parsePermissionGroupConfig,
12-
} from '@/lib/permission-groups/types'
12+
} from '@/ee/access-control/lib/types'
1313

1414
const logger = createLogger('PermissionGroup')
1515

apps/sim/app/api/permission-groups/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
DEFAULT_PERMISSION_GROUP_CONFIG,
1111
type PermissionGroupConfig,
1212
parsePermissionGroupConfig,
13-
} from '@/lib/permission-groups/types'
13+
} from '@/ee/access-control/lib/types'
1414

1515
const logger = createLogger('PermissionGroups')
1616

apps/sim/app/api/permission-groups/user/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { and, eq } from 'drizzle-orm'
44
import { NextResponse } from 'next/server'
55
import { getSession } from '@/lib/auth'
66
import { isOrganizationOnEnterprisePlan } from '@/lib/billing'
7-
import { parsePermissionGroupConfig } from '@/lib/permission-groups/types'
7+
import { parsePermissionGroupConfig } from '@/ee/access-control/lib/types'
88

99
export async function GET(req: Request) {
1010
const session = await getSession()

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export { AccessControl } from './access-control/access-control'
21
export { ApiKeys } from './api-keys/api-keys'
32
export { BYOK } from './byok/byok'
43
export { Copilot } from './copilot/copilot'
@@ -10,7 +9,6 @@ export { Files as FileUploads } from './files/files'
109
export { General } from './general/general'
1110
export { Integrations } from './integrations/integrations'
1211
export { MCP } from './mcp/mcp'
13-
export { SSO } from './sso/sso'
1412
export { Subscription } from './subscription/subscription'
1513
export { TeamManagement } from './team-management/team-management'
1614
export { WorkflowMcpServers } from './workflow-mcp-servers/workflow-mcp-servers'

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/settings-modal.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import { getEnv, isTruthy } from '@/lib/core/config/env'
4141
import { isHosted } from '@/lib/core/config/feature-flags'
4242
import { getUserRole } from '@/lib/workspaces/organization'
4343
import {
44-
AccessControl,
4544
ApiKeys,
4645
BYOK,
4746
Copilot,
@@ -53,15 +52,15 @@ import {
5352
General,
5453
Integrations,
5554
MCP,
56-
SSO,
5755
Subscription,
5856
TeamManagement,
5957
WorkflowMcpServers,
6058
} from '@/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components'
6159
import { TemplateProfile } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/template-profile/template-profile'
60+
import { AccessControl } from '@/ee/access-control'
61+
import { SSO, ssoKeys, useSSOProviders } from '@/ee/sso'
6262
import { generalSettingsKeys, useGeneralSettings } from '@/hooks/queries/general-settings'
6363
import { organizationKeys, useOrganizations } from '@/hooks/queries/organization'
64-
import { ssoKeys, useSSOProviders } from '@/hooks/queries/sso'
6564
import { subscriptionKeys, useSubscriptionData } from '@/hooks/queries/subscription'
6665
import { usePermissionConfig } from '@/hooks/use-permission-config'
6766
import { useSettingsModalStore } from '@/stores/modals/settings/store'

apps/sim/ee/LICENSE

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
The Sim Enterprise License (the "Enterprise License")
2+
Copyright (c) 2026-present Sim Studio, Inc.
3+
4+
With regard to the Sim Software:
5+
6+
This software and associated documentation files (the "Software") may only be
7+
used in production, if you (and any entity that you represent) have agreed to,
8+
and are in compliance with, the Sim Terms of Service available at
9+
https://sim.ai/terms (or other agreement governing the use of the Software,
10+
as mutually agreed by you and Sim Studio, Inc. ("Sim")), and otherwise
11+
have a valid Sim Enterprise subscription ("Enterprise Subscription")
12+
for the correct number of seats as defined in your agreement.
13+
14+
Subject to the foregoing sentence, you are free to modify this Software and
15+
publish patches to the Software. You agree that Sim and/or its licensors
16+
(as applicable) retain all right, title and interest in and to all such
17+
modifications and/or patches, and all such modifications and/or patches may
18+
only be used, copied, modified, displayed, distributed, or otherwise exploited
19+
with a valid Enterprise Subscription.
20+
21+
Notwithstanding the foregoing, you may copy and modify the Software for
22+
development and testing purposes, without requiring a subscription. You agree
23+
that Sim and/or its licensors (as applicable) retain all right, title
24+
and interest in and to all such modifications.
25+
26+
You are not granted any other rights beyond what is expressly stated herein.
27+
Subject to the foregoing, it is forbidden to copy, merge, publish, distribute,
28+
sublicense, and/or sell the Software.
29+
30+
This Enterprise License applies only to the part of this Software that is not
31+
distributed under the Apache License 2.0. Any part of this Software distributed
32+
under the Apache License 2.0 is copyrighted under that license. The full text
33+
of this Enterprise License shall be included in all copies or substantial
34+
portions of the Software.
35+
36+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
42+
SOFTWARE.
43+
44+
For all third party components incorporated into the Sim Software, those
45+
components are licensed under the original license provided by the owner of the
46+
applicable component.

apps/sim/ee/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Sim Enterprise Edition
2+
3+
This directory contains enterprise features that require a valid Sim Enterprise license for production use.
4+
5+
## Features
6+
7+
- **SSO**: SAML and OIDC single sign-on authentication
8+
- **Access Control**: Permission groups and role-based access control
9+
10+
## Structure
11+
12+
```
13+
ee/
14+
├── LICENSE
15+
├── README.md
16+
├── index.ts # Main barrel export
17+
├── sso/
18+
│ ├── index.ts
19+
│ ├── components/ # SSO settings UI
20+
│ ├── hooks/ # React Query hooks
21+
│ └── lib/ # Utilities and constants
22+
└── access-control/
23+
├── index.ts
24+
├── components/ # Access control settings UI
25+
├── hooks/ # React Query hooks
26+
└── lib/ # Types and utilities
27+
```
28+
29+
**Note:** API routes remain in `app/api/` as required by Next.js routing conventions:
30+
- SSO API: `app/api/auth/sso/`
31+
- Permission Groups API: `app/api/permission-groups/`
32+
33+
## Licensing
34+
35+
Code in this directory is **NOT** covered by the Apache 2.0 license. See [LICENSE](./LICENSE) for the Sim Enterprise License terms.
36+
37+
The rest of the Sim codebase outside this directory is licensed under Apache 2.0.
38+
39+
## For Open Source Users
40+
41+
You may delete this directory to use Sim under the Apache 2.0 license only. The application will continue to function without enterprise features.
42+
43+
## Development & Testing
44+
45+
You may copy and modify this software for development and testing purposes without requiring an Enterprise subscription. Production use requires a valid license.
46+
47+
## Enabling Enterprise Features
48+
49+
Enterprise features are controlled by environment variables and subscription status:
50+
51+
- `NEXT_PUBLIC_SSO_ENABLED` - Enable SSO for self-hosted instances
52+
- `NEXT_PUBLIC_ACCESS_CONTROL_ENABLED` - Enable access control for self-hosted instances
53+
54+
On the hosted platform (sim.ai), these features are automatically available with an Enterprise subscription.
55+
56+
## Usage
57+
58+
```typescript
59+
// Import enterprise components
60+
import { SSO, AccessControl } from '@/ee'
61+
62+
// Or import specific features
63+
import { SSO, useSSOProviders } from '@/ee/sso'
64+
import { AccessControl, usePermissionGroups } from '@/ee/access-control'
65+
```
66+
67+
## Contact
68+
69+
For Enterprise licensing inquiries, contact [sales@sim.ai](mailto:sales@sim.ai).

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/access-control/access-control.tsx renamed to apps/sim/ee/access-control/components/access-control.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ import {
2525
import { Input as BaseInput, Skeleton } from '@/components/ui'
2626
import { useSession } from '@/lib/auth/auth-client'
2727
import { getSubscriptionStatus } from '@/lib/billing/client'
28-
import type { PermissionGroupConfig } from '@/lib/permission-groups/types'
2928
import { getUserColor } from '@/lib/workspaces/colors'
3029
import { getUserRole } from '@/lib/workspaces/organization'
3130
import { getAllBlocks } from '@/blocks'
32-
import { useOrganization, useOrganizations } from '@/hooks/queries/organization'
3331
import {
3432
type PermissionGroup,
3533
useBulkAddPermissionGroupMembers,
@@ -39,7 +37,9 @@ import {
3937
usePermissionGroups,
4038
useRemovePermissionGroupMember,
4139
useUpdatePermissionGroup,
42-
} from '@/hooks/queries/permission-groups'
40+
} from '@/ee/access-control/hooks/permission-groups'
41+
import type { PermissionGroupConfig } from '@/ee/access-control/lib/types'
42+
import { useOrganization, useOrganizations } from '@/hooks/queries/organization'
4343
import { useSubscriptionData } from '@/hooks/queries/subscription'
4444
import { PROVIDER_DEFINITIONS } from '@/providers/models'
4545
import { getAllProviderIds } from '@/providers/utils'

apps/sim/hooks/queries/permission-groups.ts renamed to apps/sim/ee/access-control/hooks/permission-groups.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
2-
import type { PermissionGroupConfig } from '@/lib/permission-groups/types'
2+
import type { PermissionGroupConfig } from '@/ee/access-control/lib/types'
33
import { fetchJson } from '@/hooks/selectors/helpers'
44

55
export interface PermissionGroup {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export { AccessControl } from './components/access-control'
2+
export {
3+
type BulkAddMembersData,
4+
type CreatePermissionGroupData,
5+
type DeletePermissionGroupParams,
6+
type PermissionGroup,
7+
type PermissionGroupMember,
8+
permissionGroupKeys,
9+
type UpdatePermissionGroupData,
10+
type UserPermissionConfig,
11+
useAddPermissionGroupMember,
12+
useBulkAddPermissionGroupMembers,
13+
useCreatePermissionGroup,
14+
useDeletePermissionGroup,
15+
usePermissionGroup,
16+
usePermissionGroupMembers,
17+
usePermissionGroups,
18+
useRemovePermissionGroupMember,
19+
useUpdatePermissionGroup,
20+
useUserPermissionConfig,
21+
} from './hooks/permission-groups'
22+
export type { PermissionGroupConfig } from './lib/types'
23+
export {
24+
DEFAULT_PERMISSION_GROUP_CONFIG,
25+
parsePermissionGroupConfig,
26+
} from './lib/types'

0 commit comments

Comments
 (0)