Skip to content

Commit 005ca14

Browse files
committed
chore(access-control): document and type permission controls
1 parent 4912742 commit 005ca14

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎apps/sim/ee/access-control/components/access-state-select.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const ACCESS_OPTIONS = [
55
{ value: 'allowed', label: 'Allowed' },
66
{ value: 'requestable', label: 'Can request' },
77
{ value: 'unavailable', label: 'Unavailable' },
8-
]
8+
] as const
99

1010
interface AccessStateSelectProps {
1111
label: string
@@ -15,6 +15,7 @@ interface AccessStateSelectProps {
1515
canRequest?: boolean
1616
}
1717

18+
/** Selects a group policy state, retaining unsupported inherited values while disabled. */
1819
export function AccessStateSelect({
1920
label,
2021
value,
@@ -47,6 +48,7 @@ interface BulkAccessSelectProps {
4748
canRequest?: boolean
4849
}
4950

51+
/** Emits a bulk policy choice; the caller selects targets and whether they support requests. */
5052
export function BulkAccessSelect({ onChange, disabled, canRequest = true }: BulkAccessSelectProps) {
5153
return (
5254
<ChipDropdown

‎apps/sim/ee/access-control/components/permission-rows.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import type { ProviderId } from '@/providers/types'
3939
import type { ProviderName } from '@/stores/providers'
4040
import { getToolMetadata } from '@/tools/metadata'
4141

42+
/** Resolves draft policy and inheritance, checks request support, and stages edits without saving. */
4243
export interface PermissionEditorControls {
4344
getState: (target: AccessRequestTarget) => PermissionGroupAccessState
4445
isInherited: (target: AccessRequestTarget) => boolean
@@ -75,6 +76,7 @@ interface PermissionBulkSelectProps extends PermissionEditorControls {
7576
targets: AccessRequestTarget[]
7677
}
7778

79+
/** Edits non-inherited targets, offering requests only when every editable target supports them. */
7880
export function PermissionBulkSelect({ targets, ...controls }: PermissionBulkSelectProps) {
7981
const editable = targets.filter((target) => !controls.isInherited(target))
8082
return (
@@ -118,6 +120,7 @@ interface PlatformPermissionRowProps extends PermissionEditorControls {
118120
children?: ReactNode
119121
}
120122

123+
/** Edits a platform feature with optional child controls; inert organization-only rows stay disabled. */
121124
export function PlatformPermissionRow({
122125
feature,
123126
inert,
@@ -182,6 +185,7 @@ interface PermissionGridProps extends PermissionEditorControls {
182185
emptyLabel: string
183186
}
184187

188+
/** Searches items of one target kind and limits bulk edits to the visible, editable rows. */
185189
export function PermissionGrid({
186190
items,
187191
kind,
@@ -279,6 +283,7 @@ interface ProviderRowProps extends PermissionEditorControls {
279283
workspaceId?: string
280284
}
281285

286+
/** Edits a provider and its inherited model choices, using workspace-scoped dynamic models when needed. */
282287
export function ProviderRow({ providerId, workspaceId, ...controls }: ProviderRowProps) {
283288
const [expanded, setExpanded] = useState(false)
284289
const definition = PROVIDER_DEFINITIONS[providerId]
@@ -341,6 +346,7 @@ interface BlockToolRowProps extends PermissionEditorControls {
341346
block: BlockConfig
342347
}
343348

349+
/** Edits a block and its tool operations, preserving child choices while a parent restricts access. */
344350
export function BlockToolRow({ block, ...controls }: BlockToolRowProps) {
345351
const [expanded, setExpanded] = useState(false)
346352
const childControls = inheritedControls({ kind: 'integration', id: block.type }, controls)

‎apps/sim/ee/access-requests/lib/targets.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ function integrationDenied(config: PermissionGroupConfig, integrationId: string)
308308
)
309309
}
310310

311+
/** Group policy state before applying deployment availability, workspace roles, and scope. */
311312
export type PermissionGroupAccessState = 'allowed' | 'requestable' | 'unavailable'
312313

313314
/** Prerequisites whose restrictions an approval would also have to lift. */

0 commit comments

Comments
 (0)