feat(oauth2): selectable console scopes + named per-project sections on consent

Refactor the consent screen for the per-project RAR model:

- Console access is now individually selectable: each account-tier scope
  (teams.*, projects.*, organization.keys.*, domains.*) renders as a checkbox
  with a real description; identity and account.admin stay read-only. The
  chosen subset is sent as a downscoped `scope` to oauth2.approve (RFC 6749
  §3.3) — bumps the @appwrite.io/console SDK to a build that exposes the param.
- Project access shows the actual project name + avatar + region per RAR entry
  (resolved client-side via the user's orgs → listProjects), so the user can
  tell which project each grant refers to. Unresolved ids fall back to the raw
  id. Multi-project entries list all names (truncated past five).
- Sync the RAR type to the renamed `appwrite_project` (was `appwrite_console`)
  and add splitSelectableScopes + project-name resolution helpers.

Authorize stays enabled whenever anything is granted (incl. identity-only).
This commit is contained in:
Chirag Aggarwal committed 2026-06-26 11:43:19 +05:30
1 parent 39af2c8f67
commit 13416cd6a7
5 files changed
+384 -151

No files matched your search

+2 -2
View File
@@ -6,7 +6,7 @@
"name": "@appwrite/console",
"dependencies": {
"@ai-sdk/svelte": "^1.1.24",
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@4851d03",
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@88cc66d",
"@appwrite.io/pink-icons": "0.25.0",
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3",
"@appwrite.io/pink-legacy": "^1.0.3",
@@ -126,7 +126,7 @@
"@analytics/type-utils": ["@analytics/type-utils@0.6.4", "", {}, "sha512-Ou1gQxFakOWLcPnbFVsrPb8g1wLLUZYYJXDPjHkG07+5mustGs5yqACx42UAu4A6NszNN6Z5gGxhyH45zPWRxw=="],
"@appwrite.io/console": ["@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@4851d03", { "dependencies": { "json-bigint": "1.0.0" } }, "sha512-Zhisu5a5Y6yS4MTk3G3ZA205rELJ9BSzp65MKqVmim3ii/tBSoAKiVnhBPDRR5V8Kg7FLGFW+D3dKPMspFHC/g=="],
"@appwrite.io/console": ["@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@88cc66d", { "dependencies": { "json-bigint": "1.0.0" } }],
"@appwrite.io/pink-icons": ["@appwrite.io/pink-icons@0.25.0", "", {}, "sha512-0O3i2oEuh5mWvjO80i+X6rbzrWLJ1m5wmv2/M3a1p2PyBJsFxN8xQMTEmTn3Wl/D26SsM7SpzbdW6gmfgoVU9Q=="],
+1 -1
View File
@@ -20,7 +20,7 @@
},
"dependencies": {
"@ai-sdk/svelte": "^1.1.24",
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@4851d03",
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@88cc66d",
"@appwrite.io/pink-icons": "0.25.0",
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3",
"@appwrite.io/pink-legacy": "^1.0.3",
+92 -14
View File
@@ -1,22 +1,28 @@
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getTeamOrOrganizationList } from '$lib/stores/organization';
/**
* RFC 9396 Rich Authorization Requests (RAR) helpers for the OAuth2 consent
* screen.
*
* The console OAuth2 server keeps a small set of identity scopes on the
* standard `scope` parameter (`openid`, `profile`, `email`, `account.admin`)
* and moves every granular permission into `authorization_details` entries of
* type `appwrite_console`. The consent screen lets the user approve a *subset*
* of the requested actions; the approved set is sent back to the approve
* endpoint and replaces what the client originally requested. We only ever
* downscope — actions the client did not request are never offered.
* The console OAuth2 server keeps identity + account/console-tier scopes on the
* standard `scope` parameter (`openid`, `profile`, `email`, `account.admin`,
* plus `teams.*`, `projects.*`, …) and moves every project-tier permission into
* `authorization_details` entries of type `appwrite_project`, each bound to the
* concrete `projectIds` it applies to. The consent screen lets the user approve
* a *subset* of the requested actions; the approved set is sent back to the
* approve endpoint and replaces what the client originally requested. We only
* ever downscope — actions the client did not request are never offered.
*/
/** The single RAR `type` the console OAuth2 server understands. */
export const APPWRITE_CONSOLE_RAR_TYPE = 'appwrite_console';
export const APPWRITE_PROJECT_RAR_TYPE = 'appwrite_project';
/** Fields an `appwrite_console` entry may carry, besides `type`/`actions`. */
/** The reserved internal project id; never a valid RAR target. */
const RESERVED_CONSOLE_PROJECT = 'console';
/** Fields an `appwrite_project` entry may carry, besides `type`/`actions`. */
const RESOURCE_FIELDS = ['projectIds', 'organizationIds', 'locations'] as const;
export interface AuthorizationDetail {
@@ -86,11 +92,11 @@ export function parseAuthorizationDetails(raw: string | null | undefined): Autho
}
}
export function isAppwriteConsoleDetail(detail: AuthorizationDetail): boolean {
return detail.type === APPWRITE_CONSOLE_RAR_TYPE;
export function isAppwriteProjectDetail(detail: AuthorizationDetail): boolean {
return detail.type === APPWRITE_PROJECT_RAR_TYPE;
}
/** Distinct, requested actions for a single `appwrite_console` entry. */
/** Distinct, requested actions for a single `appwrite_project` entry. */
export function actionsOf(detail: AuthorizationDetail): string[] {
if (!Array.isArray(detail.actions)) return [];
const seen = new Set<string>();
@@ -172,7 +178,7 @@ export function serializeGrantedDetails(
const granted: AuthorizationDetail[] = [];
requested.forEach((detail, index) => {
if (!isAppwriteConsoleDetail(detail)) {
if (!isAppwriteProjectDetail(detail)) {
granted.push(detail);
return;
}
@@ -186,7 +192,7 @@ export function serializeGrantedDetails(
}
const rebuilt: AuthorizationDetail = {
type: APPWRITE_CONSOLE_RAR_TYPE,
type: APPWRITE_PROJECT_RAR_TYPE,
actions: keptActions
};
for (const field of RESOURCE_FIELDS) {
@@ -200,3 +206,75 @@ export function serializeGrantedDetails(
return JSON.stringify(granted);
}
export interface ResolvedProject {
id: string;
/** Project name, or the raw id when it couldn't be resolved. */
name: string;
region?: string;
/** True when a real project name was found; false means we fell back to id. */
resolved: boolean;
}
export type ProjectNameMap = Map<string, ResolvedProject>;
/** Unique, real project ids referenced across all appwrite_project entries. */
export function collectProjectIds(details: AuthorizationDetail[]): string[] {
const seen = new Set<string>();
for (const detail of details) {
if (!isAppwriteProjectDetail(detail)) continue;
for (const id of detail.projectIds ?? []) {
if (typeof id === 'string' && id !== '' && id !== RESERVED_CONSOLE_PROJECT) {
seen.add(id);
}
}
}
return [...seen];
}
/**
* Best-effort resolution of project ids to their display names. A bare project
* id can't be fetched directly — projects are reachable only through their
* owning organization — so we list the user's organizations and ask each for
* the requested ids. Anything we can't find (not owned, or in a non-primary
* region the console endpoint doesn't see) falls back to showing the raw id.
* Never throws: on any failure the caller still gets an id-only map.
*/
export async function resolveProjectNames(ids: string[]): Promise<ProjectNameMap> {
const map: ProjectNameMap = new Map();
for (const id of ids) {
map.set(id, { id, name: id, resolved: false });
}
if (ids.length === 0) return map;
try {
const orgs = await getTeamOrOrganizationList([Query.limit(100)]);
const results = await Promise.allSettled(
orgs.teams.map((org) =>
sdk.forConsole.organization(org.$id).listProjects({
queries: [
Query.equal('$id', ids),
Query.select(['$id', 'name', 'region', 'teamId']),
Query.limit(ids.length)
]
})
)
);
for (const result of results) {
if (result.status !== 'fulfilled') continue;
for (const project of result.value.projects) {
map.set(project.$id, {
id: project.$id,
name: project.name,
region: project.region,
resolved: true
});
}
}
} catch {
// Keep the id-only fallback map.
}
return map;
}
+94
View File
@@ -2,6 +2,10 @@ import type { ComponentType } from 'svelte';
import {
IconShieldCheck,
IconUser,
IconUserCircle,
IconUserGroup,
IconViewGrid,
IconGlobe,
IconMail,
IconIdentification,
IconKey
@@ -43,6 +47,53 @@ const BUILTIN_SCOPES: Record<string, Omit<ScopeDescriptor, 'id'>> = {
title: ACCOUNT_ADMIN_DESCRIPTOR.title,
description: ACCOUNT_ADMIN_DESCRIPTOR.description,
icon: ACCOUNT_ADMIN_DESCRIPTOR.icon
},
// Account/console-tier scopes (carried on the `scope` param). These read as
// console-level actions — managing your account, organizations, projects.
account: {
title: 'Manage your account',
description: 'Manage your account, sessions, tokens, and billing.',
icon: IconUserCircle
},
'teams.read': {
title: 'View your organizations',
description: 'Read the organizations you belong to.',
icon: IconUserGroup
},
'teams.write': {
title: 'Manage your organizations',
description: 'Create, update, and delete your organizations and their members.',
icon: IconUserGroup
},
'projects.read': {
title: 'View your projects',
description: 'List the projects in your organizations.',
icon: IconViewGrid
},
'projects.write': {
title: 'Manage your projects',
description: 'Create, update, and delete projects in your organizations.',
icon: IconViewGrid
},
'organization.keys.read': {
title: 'View organization API keys',
description: "Read your organizations' API keys.",
icon: IconKey
},
'organization.keys.write': {
title: 'Manage organization API keys',
description: "Create, update, and delete your organizations' API keys.",
icon: IconKey
},
'domains.read': {
title: 'View organization domains',
description: "Read your organizations' domains.",
icon: IconGlobe
},
'domains.write': {
title: 'Manage organization domains',
description: "Create, update, and delete your organizations' domains.",
icon: IconGlobe
}
};
@@ -99,6 +150,49 @@ export function describeConsentScopes(scopes: string[]): ScopeDescriptor[] {
return described;
}
export interface SelectableConsentScopes {
/** `account.admin` full-access descriptor, when requested (read-only). */
admin: ScopeDescriptor | null;
/** OIDC identity scopes (profile/email), always granted (read-only). */
identity: ScopeDescriptor[];
/** Account/console-tier scopes the user can individually toggle. */
selectable: ScopeDescriptor[];
}
/**
* Split the requested `scope`-param scopes for the consent screen into the
* read-only rows (full-access `account.admin`, identity scopes) and the
* individually-selectable account/console-tier scopes. Anything that isn't
* `openid`, an identity scope, or `account.admin` is treated as a selectable
* console-tier scope — the `scope` param only ever carries console-tier scopes
* (project-tier permissions travel in `authorization_details`). Request order
* is preserved.
*/
export function splitSelectableScopes(scopes: string[]): SelectableConsentScopes {
const requested = new Set(scopes);
const admin = requested.has(ACCOUNT_ADMIN_SCOPE) ? ACCOUNT_ADMIN_DESCRIPTOR : null;
const identity = CONSENT_IDENTITY_SCOPES.filter((scope) => requested.has(scope)).map(
describeScope
);
const seen = new Set<string>();
const selectable: ScopeDescriptor[] = [];
for (const scope of scopes) {
if (
scope === 'openid' ||
scope === ACCOUNT_ADMIN_SCOPE ||
(CONSENT_IDENTITY_SCOPES as readonly string[]).includes(scope) ||
seen.has(scope)
) {
continue;
}
seen.add(scope);
selectable.push(describeScope(scope));
}
return { admin, identity, selectable };
}
export interface ScopeAction {
/** Full scope id, e.g. `teams.write`. */
id: string;
+195 -134
View File
@@ -1,25 +1,40 @@
<script lang="ts">
import type { Models } from '@appwrite.io/console';
import { Accordion, Card, Layout, Typography, Icon, Spinner } from '@appwrite.io/pink-svelte';
import {
Badge,
Card,
Layout,
Typography,
Icon,
Selector,
Spinner
} from '@appwrite.io/pink-svelte';
import { IconCheck, IconExclamation } from '@appwrite.io/pink-icons-svelte';
import { Button, Form } from '$lib/elements/forms';
import AvatarInitials from '$lib/components/avatarInitials.svelte';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { groupConsentScopes } from '$lib/helpers/oauth2-scopes';
import { splitSelectableScopes } from '$lib/helpers/oauth2-scopes';
import {
actionsOf,
isAppwriteConsoleDetail,
collectProjectIds,
isAppwriteProjectDetail,
loadActionCatalog,
parseAuthorizationDetails,
resolveProjectNames,
serializeGrantedDetails,
type ActionCatalog,
type AuthorizationDetail
type AuthorizationDetail,
type ResolvedProject
} from '$lib/helpers/oauth2-authorization-details';
import OAuth2ScopePicker from './oauth2-scope-picker.svelte';
export type OAuth2Flow = 'authorization' | 'device';
/** How many project chips to show in an entry header before collapsing. */
const MAX_PROJECT_CHIPS = 5;
function hostnameOf(uri: string): string | null {
try {
return new URL(uri).hostname;
@@ -43,27 +58,28 @@
let rejecting = $state(false);
let busy = $derived(approving || rejecting);
// Requested scopes (identity + account/console-tier) are shown read-only,
// grouped by resource. The granular per-project permissions live in
// authorization_details and are chosen individually below.
const scopes = $derived(groupConsentScopes(grant.scopes ?? []));
// The `scope` param carries identity + account/console-tier scopes. Identity
// and full-access (`account.admin`) are shown read-only; the rest are
// individually selectable. Project-tier permissions live in
// authorization_details and are chosen per project below.
const scopes = $derived(splitSelectableScopes(grant.scopes ?? []));
const details = $derived<AuthorizationDetail[]>(
parseAuthorizationDetails(grant.authorizationDetails)
);
const hasConsoleActions = $derived(
details.some((detail) => isAppwriteConsoleDetail(detail) && actionsOf(detail).length > 0)
const hasProjectActions = $derived(
details.some((detail) => isAppwriteProjectDetail(detail) && actionsOf(detail).length > 0)
);
const redirectHost = $derived(hostnameOf(grant.redirectUri));
const appInitial = $derived((app.name || '?').charAt(0).toUpperCase());
const accountInitial = $derived((accountLabel || '?').charAt(0).toUpperCase());
// Lazily loaded scope metadata (category + descriptions) for grouping the
// requested actions. Never blocks approve/reject — the picker just shows a
// spinner until it resolves.
// Lazily loaded scope metadata (category + descriptions) for the per-project
// pickers. Never blocks approve/reject — the picker shows a spinner until it
// resolves.
let catalog = $state<ActionCatalog | null>(null);
$effect(() => {
if (!hasConsoleActions || catalog) return;
if (!hasProjectActions || catalog) return;
let cancelled = false;
void loadActionCatalog().then((loaded) => {
if (!cancelled) catalog = loaded;
@@ -73,16 +89,25 @@
};
});
// Per-entry action selection: entryIndex -> { action -> granted }. Requested
// actions start selected (the user opts OUT of what they don't want). Reset
// whenever the grant changes so a stale selection can't leak across requests.
// Selectable console-scope state: scopeId -> granted. Starts all-on (opt-out).
// Re-initialised whenever the grant changes so a stale selection can't leak.
let scopeSelection = $state<Record<string, boolean>>({});
$effect(() => {
grant.$id;
const next: Record<string, boolean> = {};
for (const descriptor of scopes.selectable) {
next[descriptor.id] = true;
}
scopeSelection = next;
});
// Per-entry project-action selection: entryIndex -> { action -> granted }.
let selection = $state<Record<number, Record<string, boolean>>>({});
$effect(() => {
// Re-init keyed on the grant id + its requested details.
grant.$id;
const next: Record<number, Record<string, boolean>> = {};
details.forEach((detail, index) => {
if (!isAppwriteConsoleDetail(detail)) return;
if (!isAppwriteProjectDetail(detail)) return;
const actionMap: Record<string, boolean> = {};
for (const action of actionsOf(detail)) {
actionMap[action] = true;
@@ -92,35 +117,65 @@
selection = next;
});
/** A short, human context line for an entry's resource scoping. */
function detailContext(detail: AuthorizationDetail): string | null {
const parts: string[] = [];
const projects = detail.projectIds?.length ?? 0;
const orgs = detail.organizationIds?.length ?? 0;
if (projects > 0) parts.push(`${projects} project${projects === 1 ? '' : 's'}`);
if (orgs > 0) parts.push(`${orgs} organization${orgs === 1 ? '' : 's'}`);
if (parts.length === 0) return null;
return `Limited to ${parts.join(' and ')}`;
// Best-effort id -> project resolution. Fills in asynchronously; until then
// (and for anything unresolved) headers fall back to the raw project id.
let projectNames = $state<Record<string, ResolvedProject>>({});
$effect(() => {
grant.$id;
const ids = collectProjectIds(details);
if (ids.length === 0) {
projectNames = {};
return;
}
let cancelled = false;
void resolveProjectNames(ids).then((map) => {
if (!cancelled) projectNames = Object.fromEntries(map);
});
return () => {
cancelled = true;
};
});
function projectsForDetail(detail: AuthorizationDetail): ResolvedProject[] {
return (detail.projectIds ?? [])
.filter((id): id is string => typeof id === 'string' && id !== '')
.map((id) => projectNames[id] ?? { id, name: id, resolved: false });
}
function locationHosts(detail: AuthorizationDetail): string[] {
return (detail.locations ?? [])
.map((location) => hostnameOf(location))
.filter((host): host is string => Boolean(host));
}
// Approving is meaningless if the request offered actions but the user
// unchecked every one and granted no identity scope either.
const grantedActionCount = $derived(
Object.values(selection).reduce(
(total, actionMap) =>
total + Object.values(actionMap).filter((isGranted) => isGranted).length,
(total, actionMap) => total + Object.values(actionMap).filter(Boolean).length,
0
)
);
const nothingToGrant = $derived(
hasConsoleActions && grantedActionCount === 0 && (grant.scopes ?? []).length === 0
const grantedConsoleScopeCount = $derived(
scopes.selectable.filter((descriptor) => scopeSelection[descriptor.id]).length
);
// Authorize stays enabled as long as SOMETHING is granted — a project action,
// a console scope, an identity scope, or full access.
const nothingToGrant = $derived(
grantedActionCount === 0 &&
grantedConsoleScopeCount === 0 &&
scopes.identity.length === 0 &&
!scopes.admin &&
!(grant.scopes ?? []).includes('openid')
);
/** The downscoped `scope` string the user consented to (identity always kept). */
function buildGrantedScope(): string {
const requested = grant.scopes ?? [];
const granted: string[] = [];
const add = (scope: string) => {
if (!granted.includes(scope)) granted.push(scope);
};
if (requested.includes('openid')) add('openid');
for (const descriptor of scopes.identity) add(descriptor.id);
if (scopes.admin) add(scopes.admin.id);
for (const descriptor of scopes.selectable) {
if (scopeSelection[descriptor.id]) add(descriptor.id);
}
return granted.join(' ');
}
async function approve() {
if (busy) return;
@@ -132,16 +187,15 @@
error = null;
approving = true;
try {
// When the request carries appwrite_console actions, send back the
// exact subset the user consented to (downscope-only — the picker
// never offers actions the client didn't request). Otherwise omit
// it and keep whatever the client originally requested.
const authorizationDetails = hasConsoleActions
? serializeGrantedDetails(details, selection)
: undefined;
// Send back exactly what the user consented to (downscope-only): the
// selected console scopes via `scope`, and the selected project
// actions via `authorization_details` (when any were requested).
const result = await sdk.forConsole.oauth2.approve({
grantId,
authorizationDetails
scope: buildGrantedScope(),
authorizationDetails: hasProjectActions
? serializeGrantedDetails(details, selection)
: undefined
});
if (grant.$id !== grantId) return;
trackEvent(Submit.AccountOAuth2ConsentApprove, {
@@ -243,53 +297,78 @@
</span>
<span class="scope-text">
<span class="scope-title">{scope.title}</span>
<span class="scope-desc">{scope.description}</span>
</span>
</li>
{/each}
</ul>
{/if}
{#if scopes.groups.length > 0}
<div class="scope-accordion">
<Accordion title="Account access" badge={String(scopes.granularCount)}>
<ul class="scope-group-list">
{#each scopes.groups as group (group.resource)}
<li class="scope-group">
<span class="scope-icon">
<Icon icon={group.icon} size="s" />
</span>
<span class="scope-group-title">{group.title}</span>
<span class="scope-group-actions">
{#each group.actions as action (action.id)}
<span class="scope-action-tag">{action.label}</span>
{/each}
</span>
</li>
{/each}
</ul>
</Accordion>
</div>
{#if scopes.selectable.length > 0}
<Layout.Stack gap="s">
<Typography.Text variant="m-500">Console access</Typography.Text>
<ul class="scope-list">
{#each scopes.selectable as scope (scope.id)}
<li class="scope-item">
<span class="scope-check">
<Selector.Checkbox
size="s"
id={`scope-${scope.id}`}
disabled={busy || !!scopes.admin}
bind:checked={scopeSelection[scope.id]} />
</span>
<label class="scope-text" for={`scope-${scope.id}`}>
<span class="scope-title">{scope.title}</span>
<span class="scope-desc">{scope.description}</span>
</label>
</li>
{/each}
</ul>
{#if scopes.admin}
<Typography.Text variant="m-400" color="--fgcolor-neutral-tertiary">
Full access is granted, so these are included.
</Typography.Text>
{/if}
</Layout.Stack>
{/if}
{#if details.length > 0}
<Layout.Stack gap="m">
<Layout.Stack gap="xxs">
<Typography.Text variant="m-500">Choose what to allow</Typography.Text>
<Typography.Text variant="m-500">Project access</Typography.Text>
<Typography.Text variant="m-400" color="--fgcolor-neutral-secondary">
{app.name} requested these permissions. Grant only the ones you're comfortable
with — you can turn any of them off.
{app.name} requested access to these projects. Grant only the permissions you're
comfortable with — you can turn any of them off.
</Typography.Text>
</Layout.Stack>
{#each details as detail, index (`${detail.type}-${index}`)}
{#if isAppwriteConsoleDetail(detail) && actionsOf(detail).length > 0}
{@const context = detailContext(detail)}
{@const hosts = locationHosts(detail)}
{#if isAppwriteProjectDetail(detail) && actionsOf(detail).length > 0}
{@const projects = projectsForDetail(detail)}
<div class="detail-section">
{#if context || hosts.length > 0}
<div class="detail-context">
{#if context}<span>{context}</span>{/if}
{#if hosts.length > 0}<span>{hosts.join(', ')}</span>{/if}
{#if projects.length > 0}
<div class="project-header">
{#each projects.slice(0, MAX_PROJECT_CHIPS) as project (project.id)}
<span class="project-chip">
<AvatarInitials size="xs" name={project.name} />
<span
class="project-name"
class:mono={!project.resolved}>
{project.name}
</span>
{#if project.region}
<Badge
size="xs"
variant="secondary"
content={project.region} />
{/if}
</span>
{/each}
{#if projects.length > MAX_PROJECT_CHIPS}
<span class="project-more">
+{projects.length - MAX_PROJECT_CHIPS} more
</span>
{/if}
</div>
{/if}
{#if catalog}
@@ -440,7 +519,8 @@
border-top: 1px solid var(--border-neutral);
}
.scope-icon {
.scope-icon,
.scope-check {
flex-shrink: 0;
display: flex;
align-items: center;
@@ -460,6 +540,10 @@
min-width: 0;
}
label.scope-text {
cursor: pointer;
}
.scope-title {
font-size: 0.875rem;
font-weight: 500;
@@ -477,58 +561,6 @@
color: var(--fgcolor-neutral-secondary);
}
/* Collapsed bucket of granular console scopes, grouped by resource. */
.scope-accordion {
border: 1px solid var(--border-neutral);
border-radius: 0.75rem;
overflow: hidden;
}
.scope-group-list {
list-style: none;
margin: 0;
padding-block-start: 0.25rem;
padding-inline-end: 0.25rem;
}
.scope-group {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.8rem 0;
}
.scope-group + .scope-group {
border-top: 1px solid var(--border-neutral);
}
.scope-group-title {
flex: 1;
min-width: 0;
font-size: 0.875rem;
font-weight: 500;
line-height: 1.3;
color: var(--fgcolor-neutral-primary);
}
.scope-group-actions {
display: flex;
flex-shrink: 0;
flex-wrap: wrap;
justify-content: flex-end;
gap: 0.3rem;
}
.scope-action-tag {
font-size: 0.72rem;
line-height: 1.4;
color: var(--fgcolor-neutral-secondary);
border: 1px solid var(--border-neutral-strong);
border-radius: 0.4rem;
padding: 0.1rem 0.4rem;
background: var(--bgcolor-neutral-default);
}
/* Rich authorization details — one bordered picker section per requested entry. */
.detail-section {
border: 1px solid var(--border-neutral);
@@ -541,11 +573,40 @@
margin-top: 0.5rem;
}
.detail-context {
/* Project name(s) this entry's permissions apply to. */
.project-header {
display: flex;
flex-wrap: wrap;
gap: 0.25rem 0.75rem;
margin-bottom: 0.75rem;
align-items: center;
gap: 0.4rem 0.6rem;
margin-bottom: 0.85rem;
}
.project-chip {
display: inline-flex;
align-items: center;
gap: 0.4rem;
min-width: 0;
}
.project-name {
font-size: 0.85rem;
font-weight: 500;
line-height: 1.3;
color: var(--fgcolor-neutral-primary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.project-name.mono {
font-family: var(--font-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
font-size: 0.78rem;
font-weight: 400;
color: var(--fgcolor-neutral-secondary);
}
.project-more {
font-size: 0.78rem;
color: var(--fgcolor-neutral-tertiary);
}