Skip to content

Commit db76a84

Browse files
committed
improvement(access-control): align permission rows and contextual help
1 parent 005ca14 commit db76a84

5 files changed

Lines changed: 277 additions & 190 deletions

File tree

‎apps/docs/content/docs/platform/enterprise/access-control.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Search and the state filter narrow each list. **Set shown to…** changes only t
3434

3535
A restricted parent also restricts its children. Expand a provider, integration, or platform feature to inspect its models, tools, connectors, or authentication modes. Allow the parent before editing its children. Child choices are preserved when a parent changes. An unavailable child stays unavailable even if its parent allows requests. Requests cannot bypass an unavailable parent.
3636

37+
The info icon beside an item explains its restriction and, for inherited choices, names the parent to change. Hover or focus the icon to read the help, or click or tap to keep it open. Press Escape or click outside to dismiss it.
38+
3739
These choices configure the group's policy, independently of the deployment's current availability. **Allowed** and **Can request** cannot enable a deployment-disabled feature or bypass a workspace role. Members only discover and request items available to their deployment and role. Custom blocks, private dynamically discovered models, and other items outside the public request catalog do not offer **Can request**.
3840

3941
### General

‎apps/sim/app/workspace/[workspaceId]/settings/components/settings-resource-row/settings-resource-row.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ interface SettingsResourceRowProps {
9090
* the bleed would force a horizontal scrollbar.
9191
*/
9292
flush?: boolean
93+
/** Compact single-line controls retain a 40px row without changing the default resource layout. */
94+
density?: 'default' | 'compact'
9395
/** Renders the row as unavailable without an activation target. */
9496
disabled?: boolean
9597
}
@@ -133,6 +135,7 @@ export function SettingsResourceRow({
133135
clickLabel,
134136
navigable = false,
135137
flush = false,
138+
density = 'default',
136139
disabled = false,
137140
}: SettingsResourceRowProps) {
138141
const describedById = useId()
@@ -202,7 +205,9 @@ export function SettingsResourceRow({
202205
// mixing clickable and static rows keeps one height and one inset.
203206
const rowClass = cn(
204207
'flex items-center justify-between gap-2.5',
205-
!flush && '-mx-2 rounded-lg p-2',
208+
!flush && '-mx-2 rounded-lg',
209+
!flush && (density === 'compact' ? 'px-2' : 'p-2'),
210+
density === 'compact' && 'min-h-10 max-md:pointer-coarse:min-h-11',
206211
disabled && 'opacity-50'
207212
)
208213

‎apps/sim/ee/access-control/components/group-detail.tsx‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import { withPermissionGroupAccessState } from '@/ee/access-control/utils/access
8080
import {
8181
type AccessRequestTarget,
8282
createAccessRequestCatalog,
83+
describeAccessRequestTarget,
8384
getAccessRequestTargetParents,
8485
getPermissionGroupAccessState,
8586
type PermissionGroupAccessState,
@@ -523,10 +524,19 @@ export function GroupDetail({
523524
[editingConfig, editorCatalog, canRequest]
524525
)
525526

526-
const isInherited = (target: AccessRequestTarget) =>
527-
getAccessRequestTargetParents(target, editorCatalog).some(
527+
const getInheritedFrom = (target: AccessRequestTarget): string | null => {
528+
const parent = getAccessRequestTargetParents(target, editorCatalog).find(
528529
(parent) => getState(parent) !== 'allowed'
529530
)
531+
if (!parent) return null
532+
return (
533+
getInheritedFrom(parent) ??
534+
describeAccessRequestTarget(parent, editorCatalog)?.label ??
535+
'a restricted parent'
536+
)
537+
}
538+
539+
const isInherited = (target: AccessRequestTarget) => getInheritedFrom(target) !== null
530540

531541
const setAccess = (targets: AccessRequestTarget[], state: PermissionGroupAccessState) => {
532542
setEditingConfig((previous) => {
@@ -544,7 +554,7 @@ export function GroupDetail({
544554
})
545555
}
546556

547-
const controls = { getState, isInherited, canRequest, onSet: setAccess }
557+
const controls = { getState, isInherited, getInheritedFrom, canRequest, onSet: setAccess }
548558

549559
const searchedPlatformFeatures = useMemo(() => {
550560
const search = searchTerm.trim().toLowerCase()
@@ -1152,7 +1162,7 @@ export function GroupDetail({
11521162
<SettingsSection
11531163
label='Integrations and Triggers'
11541164
headerAccessory={
1155-
<Info side='top'>
1165+
<Info side='top' label='About integration and trigger permissions'>
11561166
Choose access for an integration, then expand it to set individual tools. Parent
11571167
restrictions apply to every tool.
11581168
</Info>
@@ -1205,7 +1215,10 @@ export function GroupDetail({
12051215
</SettingsEmptyState>
12061216
)}
12071217
{platformCategorySections.map(({ category, features }) => (
1208-
<SettingsSection key={category} label={category}>
1218+
<SettingsSection
1219+
key={category}
1220+
label={<span className='flex h-[30px] items-center'>{category}</span>}
1221+
>
12091222
<div className='flex flex-col gap-0.5'>
12101223
{features.map((feature) => (
12111224
<PlatformPermissionRow

0 commit comments

Comments
 (0)