@coffre/ui 0.4.6 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{affordances-DAvsVz7u.js → affordances-Bqdevf7w.js} +10 -5
- package/dist/chunks/affordances-Bqdevf7w.js.map +1 -0
- package/dist/chunks/{audit-sentence-DIztXvbU.js → audit-sentence-Cm5nby5k.js} +105 -7
- package/dist/chunks/audit-sentence-Cm5nby5k.js.map +1 -0
- package/dist/chunks/{connected-apps-AZsX9Zvv.js → connected-apps-DTNS7YmY.js} +2 -2
- package/dist/chunks/{connected-apps-AZsX9Zvv.js.map → connected-apps-DTNS7YmY.js.map} +1 -1
- package/dist/chunks/{delete-place-D6LIZkg9.js → delete-place-CIaOq0mt.js} +3 -3
- package/dist/chunks/{delete-place-D6LIZkg9.js.map → delete-place-CIaOq0mt.js.map} +1 -1
- package/dist/chunks/{directory-B6FuiCir.js → directory-DSVt5Tya.js} +54 -60
- package/dist/chunks/directory-DSVt5Tya.js.map +1 -0
- package/dist/chunks/{folders-DvSqBhuu.js → folders-CoGK9oqg.js} +2 -2
- package/dist/chunks/{folders-DvSqBhuu.js.map → folders-CoGK9oqg.js.map} +1 -1
- package/dist/chunks/grants-CRU7yZhL.js +164 -0
- package/dist/chunks/grants-CRU7yZhL.js.map +1 -0
- package/dist/chunks/{offboarding-CLJaNTcD.js → offboarding-DVBSiJRZ.js} +7 -3
- package/dist/chunks/offboarding-DVBSiJRZ.js.map +1 -0
- package/dist/chunks/{principal-page-1yMztIcc.js → principal-page-BEBr_zW7.js} +350 -91
- package/dist/chunks/principal-page-BEBr_zW7.js.map +1 -0
- package/dist/chunks/{project-page-C4cEaRFa.js → project-page-B3TZ5_ig.js} +2 -2
- package/dist/chunks/{project-page-C4cEaRFa.js.map → project-page-B3TZ5_ig.js.map} +1 -1
- package/dist/chunks/{queries-Dew8mIeo.js → queries-DE5nK2y4.js} +132 -54
- package/dist/chunks/queries-DE5nK2y4.js.map +1 -0
- package/dist/chunks/{references-DWDnXNoW.js → references-uv4Mli9z.js} +4 -3
- package/dist/chunks/{references-DWDnXNoW.js.map → references-uv4Mli9z.js.map} +1 -1
- package/dist/chunks/role-field-DWhkRY6n.js +192 -0
- package/dist/chunks/role-field-DWhkRY6n.js.map +1 -0
- package/dist/chunks/use-action-BRgvbUWt.js +49 -0
- package/dist/chunks/use-action-BRgvbUWt.js.map +1 -0
- package/dist/chunks/{use-change-C4bGRhHY.js → use-change-BJ3dCFHb.js} +40 -14
- package/dist/chunks/use-change-BJ3dCFHb.js.map +1 -0
- package/dist/chunks/{use-shell-Dkv89nW1.js → use-shell-BO4ZTr1y.js} +2 -2
- package/dist/chunks/{use-shell-Dkv89nW1.js.map → use-shell-BO4ZTr1y.js.map} +1 -1
- package/dist/chunks/validation-DiHIwZRA.js +37 -0
- package/dist/chunks/validation-DiHIwZRA.js.map +1 -0
- package/dist/index.d.ts +111 -88
- package/dist/index.js +40 -21
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +8 -7
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/audit.js +2 -2
- package/dist/pages/environment.js +8 -7
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +2 -2
- package/dist/pages/login.js.map +1 -1
- package/dist/pages/project-access.js +7 -7
- package/dist/pages/project-environments.js +26 -21
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.js +9 -8
- package/dist/pages/project-settings.js.map +1 -1
- package/dist/pages/project.js +1 -1
- package/dist/pages/projects.js +8 -13
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +294 -88
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +7 -7
- package/dist/pages/service-accounts.js.map +1 -1
- package/dist/pages/settings.js +91 -9
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.d.ts +1 -1
- package/dist/pages/unregistered.js +4 -4
- package/dist/pages/unregistered.js.map +1 -1
- package/dist/pages/user.d.ts +2 -0
- package/dist/pages/user.js +21 -3
- package/dist/pages/user.js.map +1 -1
- package/dist/pages/users.js +4 -4
- package/package.json +3 -3
- package/src/components/affordances.ts +7 -3
- package/src/components/command-palette.tsx +2 -0
- package/src/components/directory.tsx +58 -63
- package/src/components/grants.tsx +9 -9
- package/src/components/offboarding.tsx +3 -1
- package/src/components/principal-page.tsx +124 -74
- package/src/components/role-field.tsx +183 -0
- package/src/components/scope-picker.tsx +73 -0
- package/src/components/service-tokens.tsx +20 -9
- package/src/components/shell.tsx +6 -10
- package/src/components/trusted-workloads.tsx +121 -42
- package/src/index.ts +1 -0
- package/src/lib/audit-sentences.ts +104 -3
- package/src/lib/bindings.ts +33 -10
- package/src/lib/capabilities.ts +28 -8
- package/src/lib/changes.ts +22 -13
- package/src/lib/project-access.ts +21 -0
- package/src/lib/queries.ts +121 -44
- package/src/lib/service-setup.ts +41 -0
- package/src/lib/validation.ts +7 -0
- package/src/options.ts +31 -11
- package/src/pages/account.tsx +3 -2
- package/src/pages/login.tsx +1 -1
- package/src/pages/project-environments.tsx +12 -15
- package/src/pages/project-settings.tsx +3 -3
- package/src/pages/projects.tsx +1 -5
- package/src/pages/service-account.tsx +7 -5
- package/src/pages/service-accounts.tsx +8 -4
- package/src/pages/settings.tsx +80 -4
- package/src/pages/unregistered.tsx +3 -3
- package/src/pages/user.tsx +24 -1
- package/src/parity.ts +5 -1
- package/src/register.ts +3 -1
- package/src/shared/models.ts +8 -4
- package/src/styles/globals.css +100 -27
- package/dist/chunks/affordances-DAvsVz7u.js.map +0 -1
- package/dist/chunks/audit-sentence-DIztXvbU.js.map +0 -1
- package/dist/chunks/directory-B6FuiCir.js.map +0 -1
- package/dist/chunks/grants-9kIV6uZ7.js +0 -669
- package/dist/chunks/grants-9kIV6uZ7.js.map +0 -1
- package/dist/chunks/offboarding-CLJaNTcD.js.map +0 -1
- package/dist/chunks/principal-page-1yMztIcc.js.map +0 -1
- package/dist/chunks/queries-Dew8mIeo.js.map +0 -1
- package/dist/chunks/use-change-C4bGRhHY.js.map +0 -1
- package/dist/chunks/validation-DvPinn8V.js +0 -87
- package/dist/chunks/validation-DvPinn8V.js.map +0 -1
- package/src/components/every-project.tsx +0 -287
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principal-page-BEBr_zW7.js","names":[],"sources":["../../src/components/actions-log.tsx","../../src/lib/service-setup.ts","../../src/lib/access-plan.ts","../../src/components/expiry-field.tsx","../../src/components/principal-page.tsx"],"sourcesContent":["import { useInfiniteQuery } from '@tanstack/react-query';\nimport { uiResult, useCoffre } from '../lib/coffre';\nimport { keys } from '../lib/queries';\nimport { describe, lines } from '../lib/audit-sentences';\nimport { Sentence } from './audit-sentence';\nimport { EmptyState, Notice, Spinner, Timestamp } from './ui';\nimport { Activity, Clock, ShieldCheck, SlashCircle } from './icons';\n\nconst PAGE_SIZE = 50;\n\n/**\n * Everything one member did, newest first, from the audit log: the same\n * entries `coffre audit --actor` lists, said as the audit page says them.\n * Older pages come on request.\n */\nexport function ActionsLog({ member }: { member: string }) {\n const client = useCoffre();\n const log = useInfiniteQuery({\n queryKey: [...keys.audit, 'actor', member],\n staleTime: 0,\n initialPageParam: undefined as number | undefined,\n queryFn: ({ pageParam }) =>\n uiResult(() => client.audit.list({ actor: member, limit: PAGE_SIZE, before: pageParam })),\n getNextPageParam: (page) =>\n page.ok && page.entries.length === PAGE_SIZE ? page.entries.at(-1)!.seq : undefined,\n });\n\n if (log.isPending) {\n return (\n <p className=\"hint\">\n <Spinner size={13} /> Reading the log…\n </p>\n );\n }\n const failed = log.data?.pages.find((page) => !page.ok);\n if (failed !== undefined && !failed.ok) return <Notice tone=\"bad\">{failed.error}</Notice>;\n const entries = (log.data?.pages ?? []).flatMap((page) => (page.ok ? page.entries : []));\n const shown = lines(entries);\n\n return (\n <>\n <section className=\"card\" aria-label=\"Actions log\">\n {shown.length === 0 ? (\n <EmptyState title=\"Nothing done yet\">Every read, write and change they make is listed here.</EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className=\"dt actions-log stacks stacks-inline\">\n <thead>\n <tr>\n <th className=\"col-shrink\">\n <span className=\"th\">\n <Clock size={14} />\n When\n </span>\n </th>\n <th>\n <span className=\"th\">\n <Activity size={14} />\n Action\n </span>\n </th>\n <th className=\"col-shrink\">\n <span className=\"th\">\n <ShieldCheck size={14} />\n Outcome\n </span>\n </th>\n </tr>\n </thead>\n <tbody>\n {shown.map((batch) => {\n const lead = batch[0]!;\n const sentence = describe(batch);\n return (\n <tr key={lead.seq} className={sentence.refused ? 'is-denied' : undefined}>\n <td className=\"nowrap cell-muted\" title={lead.occurredAt}>\n <Timestamp iso={lead.occurredAt} display=\"relative\" />\n </td>\n <td className=\"cell-sentence\">\n <span className=\"sentence\">\n <Sentence parts={sentence.parts} />\n </span>\n </td>\n <td className=\"nowrap\" data-label=\"Outcome\">\n {sentence.refused ? (\n <span className=\"decided decided-refused\">\n <SlashCircle size={13} />\n Refused\n </span>\n ) : (\n <span className=\"cell-muted\">Allowed</span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n )}\n </section>\n {log.hasNextPage && (\n <div className=\"table-actions\">\n <button\n type=\"button\"\n className=\"btn\"\n disabled={log.isFetchingNextPage}\n onClick={() => void log.fetchNextPage()}\n >\n {log.isFetchingNextPage && <Spinner />}\n Show older\n </button>\n </div>\n )}\n </>\n );\n}\n","import { inScope, ROLE_NAMES, ROLES, type Permission, type Role, type Scope } from '@coffre/core/access';\n\nimport type { ProjectSummary } from '../shared/models';\n\n/** What `givable` reads of the shell: the projects, what you hold in each environment, and the setting. */\ntype Holder = {\n projects: readonly ProjectSummary[];\n environments: readonly { project: string; environment: string; permissions: Permission[] }[];\n /** The instance's setting as `/me` says it, projects by slug, those you see; null for a service account. */\n serviceSetup: Scope | null;\n};\n\n/**\n * The roles you may give a service account at a project, or one of its\n * environments, as the server decides it (`givesService` in\n * @coffre/core/access): any, where you manage access; otherwise, inside the\n * instance's setting, those whose every permission you hold there.\n *\n * a Developer of every dev, at market/dev viewer, developer\n * the same, at market none: a project takes holding all of it\n */\nexport function givable(holder: Holder, project: ProjectSummary, environment: string | null): Role[] {\n const held = environment === null\n ? project.permissions\n : holder.environments.find((entry) => entry.project === project.slug && entry.environment === environment)?.permissions ?? [];\n if (held.includes('grant.manage')) return [...ROLE_NAMES];\n const setting = holder.serviceSetup;\n // The setting names projects by slug here, so a place is matched by its slugs.\n const place = environment === null\n ? { projectId: project.slug }\n : { projectId: project.slug, environmentId: environment, environmentSlug: environment };\n if (setting === null || !inScope(setting, place)) return [];\n return ROLE_NAMES.filter((role) => ROLES[role].permissions.every((permission) => held.includes(permission)));\n}\n\n/** The projects where you may give a service account something: on the project, or on one of its environments. */\nexport function serviceProjects(holder: Holder): ProjectSummary[] {\n return holder.projects.filter((project) =>\n givable(holder, project, null).length > 0 ||\n project.environments.some((environment) => givable(holder, project, environment.slug).length > 0));\n}\n","import type { AccessValue } from '@coffre/client';\nimport type { Role } from '@coffre/core/access';\n\nimport type { GrantRow } from '../shared/models';\n\n/** Read or write on one environment, and when it ends: an ISO instant, or null for never. */\nexport type EnvironmentAccess = { role: Extract<Role, 'viewer' | 'developer'>; expiresAt: string | null };\n\n/**\n * What one project is set to in a principal's access editor: nothing, owner,\n * read or write everywhere, or read or write per environment. Every grant the\n * plan asks for carries its own expiry.\n *\n * `custom` is for grants that do not fit that shape -- an auditor grant, or\n * read everywhere plus write on one environment. The editor shows them and\n * leaves them alone unless another setting is picked.\n */\nexport type AccessPlan = {\n level: 'none' | Extract<Role, 'owner' | 'viewer' | 'developer'> | 'env' | 'custom';\n /** When the project-wide level ends. */\n expiresAt: string | null;\n /** Environments without an entry get no access. */\n environments: Record<string, EnvironmentAccess>;\n};\n\nexport type HeldGrant = Pick<\n GrantRow,\n 'id' | 'role' | 'roleName' | 'environmentSlug' | 'expiresAt'\n>;\n\nexport type AccessChange =\n | { kind: 'create'; role: string; environmentSlug: string | null; expiresAt: string | null }\n | { kind: 'expiry'; grant: HeldGrant; expiresAt: string | null }\n | { kind: 'revoke'; grant: HeldGrant };\n\n/** An environment's access in a plan; slugs like `constructor` are not inherited. */\nexport function environmentAccess(plan: AccessPlan, slug: string): EnvironmentAccess | null {\n return Object.hasOwn(plan.environments, slug) ? plan.environments[slug] : null;\n}\n\n/**\n * Read what a principal holds on a project back into the editor's terms.\n * `environments` are the ones the editor can set: live, and not archived.\n */\nexport function planFromGrants(\n grants: readonly HeldGrant[],\n environments: readonly string[],\n): AccessPlan {\n if (grants.length === 0) return { level: 'none', expiresAt: null, environments: {} };\n\n const [only] = grants;\n if (\n grants.length === 1 &&\n only.environmentSlug === null &&\n (only.role === 'owner' || only.role === 'viewer' || only.role === 'developer')\n ) {\n return { level: only.role, expiresAt: only.expiresAt, environments: {} };\n }\n\n const perEnvironment: Record<string, EnvironmentAccess> = {};\n for (const grant of grants) {\n const slug = grant.environmentSlug;\n if (\n slug === null ||\n !environments.includes(slug) ||\n Object.hasOwn(perEnvironment, slug) ||\n (grant.role !== 'viewer' && grant.role !== 'developer')\n ) {\n return { level: 'custom', expiresAt: null, environments: {} };\n }\n perEnvironment[slug] = { role: grant.role, expiresAt: grant.expiresAt };\n }\n return { level: 'env', expiresAt: null, environments: perEnvironment };\n}\n\n/**\n * Switch a plan's level. Going from read or write everywhere to per\n * environment starts every environment at that level and expiry, so the\n * switch alone keeps the same reach.\n */\nexport function withLevel(\n plan: AccessPlan,\n level: AccessPlan['level'],\n environments: readonly string[],\n): AccessPlan {\n if (\n level === 'env' &&\n (plan.level === 'viewer' || plan.level === 'developer') &&\n Object.keys(plan.environments).length === 0\n ) {\n const access = { role: plan.level, expiresAt: plan.expiresAt };\n return {\n ...plan,\n level,\n environments: Object.fromEntries(environments.map((slug) => [slug, access])),\n };\n }\n return { ...plan, level };\n}\n\n/** Set one environment's access, or take it away with `null`. */\nexport function withEnvironment(\n plan: AccessPlan,\n slug: string,\n access: EnvironmentAccess | null,\n): AccessPlan {\n const environments = { ...plan.environments };\n if (access === null) delete environments[slug];\n else environments[slug] = access;\n return { ...plan, environments };\n}\n\nfunction grantsFor(\n plan: AccessPlan,\n): { role: string; environmentSlug: string | null; expiresAt: string | null }[] {\n switch (plan.level) {\n case 'none':\n case 'custom':\n return [];\n case 'owner':\n case 'viewer':\n case 'developer':\n return [{ role: plan.level, environmentSlug: null, expiresAt: plan.expiresAt }];\n case 'env':\n return Object.entries(plan.environments).map(([environmentSlug, access]) => ({\n environmentSlug,\n ...access,\n }));\n }\n}\n\n/** The server and the date field spell the same instant differently. */\nfunction sameExpiry(a: string | null, b: string | null): boolean {\n return a === b || (a !== null && b !== null && Date.parse(a) === Date.parse(b));\n}\n\n/**\n * The changes that take what is held to the plan: grants to create, grants\n * whose expiry moves, and grants to revoke, in that order. Asking for what is\n * already held yields nothing, so applying the same plan twice is a no-op.\n */\nexport function accessChanges(grants: readonly HeldGrant[], plan: AccessPlan): AccessChange[] {\n if (plan.level === 'custom') return [];\n\n const key = (grant: { role: string; environmentSlug: string | null }) =>\n `${grant.role}@${grant.environmentSlug ?? ''}`;\n const wanted = new Map(grantsFor(plan).map((grant) => [key(grant), grant]));\n const held = new Map(grants.map((grant) => [key(grant), grant]));\n\n const changes: AccessChange[] = [];\n for (const [id, grant] of wanted) {\n if (!held.has(id)) changes.push({ kind: 'create', ...grant });\n }\n for (const [id, grant] of held) {\n const want = wanted.get(id);\n if (want !== undefined && !sameExpiry(grant.expiresAt, want.expiresAt)) {\n changes.push({ kind: 'expiry', grant, expiresAt: want.expiresAt });\n }\n }\n for (const [id, grant] of held) {\n if (!wanted.has(id)) changes.push({ kind: 'revoke', grant });\n }\n return changes;\n}\n\n/**\n * The changes as the API's access patch for one project: each place it\n * touches, and the role to hold there until when, or `null` for none.\n *\n * { \"market\": null, \"market/dev\": { \"role\": \"developer\", \"until\": \"2026-12-31T23:59:59.000Z\" } }\n *\n * A place holds one role, so where a level changes, the revoke of the old\n * role and the create of the new land on the same place, and the new role\n * wins: the server replaces one with the other, never passing through none.\n */\nexport function accessPatch(project: string, changes: readonly AccessChange[]): Record<string, AccessValue> {\n const place = (environmentSlug: string | null) =>\n environmentSlug === null ? project : `${project}/${environmentSlug}`;\n const holding = (role: string, expiresAt: string | null): AccessValue =>\n expiresAt === null ? (role as Role) : { role: role as Role, until: expiresAt };\n\n const patch: Record<string, AccessValue> = {};\n for (const change of changes) {\n if (change.kind === 'revoke') patch[place(change.grant.environmentSlug)] = null;\n }\n for (const change of changes) {\n if (change.kind === 'expiry') patch[place(change.grant.environmentSlug)] = holding(change.grant.role, change.expiresAt);\n if (change.kind === 'create') patch[place(change.environmentSlug)] = holding(change.role, change.expiresAt);\n }\n return patch;\n}\n\n/** A date field's value as the instant access ends: the close of that day, UTC. */\nexport function expiryFromDate(date: string): string | null {\n return date === '' ? null : new Date(`${date}T23:59:59Z`).toISOString();\n}\n\n/** A date field's value for an expiry. Expiries are shown as UTC dates everywhere. */\nexport function dateFromExpiry(expiresAt: string | null): string {\n return expiresAt === null ? '' : expiresAt.slice(0, 10);\n}\n","import { dateFromExpiry, expiryFromDate } from '../lib/access-plan';\nimport { X } from './icons';\n\n/**\n * When one grant ends, as a date: access lasts through that day, UTC. Blank\n * reads \"Never\" where the browser lets the empty field be restyled.\n */\nexport function ExpiryField({\n label,\n expiresAt,\n onChange,\n}: {\n label: string;\n expiresAt: string | null;\n onChange: (expiresAt: string | null) => void;\n}) {\n const date = dateFromExpiry(expiresAt);\n return (\n <span className={`expiry${date === '' ? ' is-never' : ''}`}>\n <input\n className=\"input select-sm\"\n type=\"date\"\n aria-label={label}\n min={new Date().toISOString().slice(0, 10)}\n value={date}\n onChange={(event) => onChange(expiryFromDate(event.target.value))}\n />\n <span className=\"expiry-never\" aria-hidden=\"true\">\n Never\n </span>\n <button\n className=\"btn btn-quiet btn-sm btn-icon\"\n type=\"button\"\n aria-label={`${label}: never`}\n title=\"Never expires\"\n onClick={() => onChange(null)}\n >\n <X size={12} />\n </button>\n </span>\n );\n}\n","import { useState } from 'react';\nimport { useQueryClient, useSuspenseQuery } from '@tanstack/react-query';\nimport { Link, Outlet } from '@tanstack/react-router';\nimport { INSTANCE_ROLES, ROLE_NAMES, ROLES, scopeInWords, unscoped, type Role } from '@coffre/core/access';\nimport { useShell } from '../lib/use-shell';\nimport { toast } from 'sonner';\nimport { memberRef, useCoffre } from '../lib/coffre';\nimport { directoryList } from '../lib/changes';\nimport { affects, hasAppsTab, keys, listsAccess, managedProjects, queries, signInWays } from '../lib/queries';\nimport { useChangeStatus } from '../lib/use-change';\nimport { useMounted } from '../lib/mounted';\nimport { ItemFailure } from './row-state';\nimport { useAction } from '../lib/use-action';\nimport { accessRows, projectAccessLabel, type ProjectAccess } from '../lib/project-access';\nimport { givable, serviceProjects } from '../lib/service-setup';\nimport {\n accessChanges,\n accessPatch,\n dateFromExpiry,\n environmentAccess,\n expiryFromDate,\n planFromGrants,\n withEnvironment,\n withLevel,\n type AccessChange,\n type AccessPlan,\n} from '../lib/access-plan';\nimport type { MemberAccess } from '@coffre/client';\nimport type { DirectoryPrincipal, ProjectSummary } from '../shared/models';\nimport { ClosedDoor, PageHeader } from './page';\nimport { EmptyState, ErrorLine, Modal, Notice, Spinner } from './ui';\nimport { GrantRowView, GrantsTable } from './grants';\nimport { ExpiryField } from './expiry-field';\nimport { InstanceRole, KIND, PrincipalActions } from './directory';\nimport { PrincipalReportCards, RemovedNotice } from './offboarding';\nimport { PrincipalAvatar } from './principal';\nimport { Tile } from './tile';\nimport { Activity, Archive, Clock, Folder, Key, Link as LinkIcon, Pencil, Users, X } from './icons';\nimport { PageTabs } from './tabs';\n\ntype PrincipalType = DirectoryPrincipal['principalType'];\n\n/** The roles you may give at a project, or one of its environments: any where you manage access (`givable`). */\ntype Offers = (project: ProjectSummary, environment: string | null) => readonly Role[];\n\n/** Who a user or service account is to the instance, as an owner reads it; null for anyone else. */\nfunction useReport(principalType: PrincipalType, principalId: string) {\n const { capabilities } = useShell();\n return useSuspenseQuery(queries.report(useCoffre(), memberRef(principalType, principalId), capabilities.runsInstance)).data;\n}\n\n/**\n * What `loadAccess` read in one request: their role and scope, and, for each\n * project where you manage access, the grants they hold there. For a\n * service account you manage, each project where you may give it\n * something, and what (`offers`).\n */\nfunction useMemberAccess(principalType: PrincipalType, principalId: string): {\n access: MemberAccess | null;\n error: string | null;\n projects: ProjectAccess[];\n offers: Offers;\n} {\n const shell = useShell();\n const { data } = useSuspenseQuery(queries.memberAccess(useCoffre(), memberRef(principalType, principalId), listsAccess(shell)));\n const error = data !== null && !data.ok ? data.error : null;\n const access = data?.ok === true ? data : null;\n const yours = principalType === 'service' && access?.managed === true;\n const listed = yours ? serviceProjects(shell) : managedProjects(shell.projects);\n return {\n access,\n error,\n offers: yours ? (project, environment) => givable(shell, project, environment) : () => ROLE_NAMES,\n projects: listed.map((project) => ({\n project,\n grants: (access?.grants ?? []).filter((grant) => grant.project === project.slug).map((grant) => ({\n id: grant.id,\n principalType,\n principalId,\n role: grant.role,\n roleName: grant.roleName,\n permissions: grant.permissions,\n scope: grant.environment === null ? 'project' : 'environment',\n environmentSlug: grant.environment,\n expiresAt: grant.expiresAt,\n })),\n grantsError: error,\n })),\n };\n}\n\n/**\n * A user's or service account's page: who it is, its menu, and its tabs,\n * each a page of its own under this one. Access is a user's first tab; a\n * service account's is how it signs in, while it shows one. A tab the\n * deployment left out is not offered.\n */\nexport function PrincipalLayout({ principalType, principalId }: { principalType: PrincipalType; principalId: string }) {\n const shell = useShell();\n const mounted = useMounted();\n const { capabilities } = shell;\n const report = useReport(principalType, principalId);\n // A service account you manage, though you do not run the instance: what it holds, from its access.\n const { data: held } = useSuspenseQuery(queries.memberAccess(useCoffre(), memberRef(principalType, principalId), listsAccess(shell)));\n const yours = principalType === 'service' && held?.ok === true && held.managed;\n // A role change or removal made from this page's menu, refused.\n const { status, dismiss } = useChangeStatus(directoryList.queryKey);\n const change = status(memberRef(principalType, principalId));\n const kind = KIND[principalType];\n const people = principalType === 'user';\n const found = report?.ok === true ? report.report : null;\n const removed = found?.status === 'removed';\n const entry =\n found !== null && !removed\n ? {\n principalType,\n principalId,\n instanceRole: found.instanceRole,\n scope: found.scope,\n isRootAdmin: found.isRootAdmin,\n tampered: found.status === 'tampered',\n managed: principalType === 'service',\n }\n : yours\n ? { principalType, principalId, instanceRole: 'member' as const, scope: null, isRootAdmin: false, tampered: false, managed: true }\n : undefined;\n\n // Owners get a report about anyone ever registered, removed or not, so a\n // miss there means there is no such user. Everyone else only reaches this\n // page through projects they manage, or a service account they manage.\n const unknown = report?.ok === true && found === null;\n if (unknown || (report === null && managedProjects(shell.projects).length === 0 && !yours)) {\n return (\n <ClosedDoor\n icon={people ? <Users size={18} /> : <Key size={18} />}\n label={<span className=\"mono\">{people ? principalId : `service:${principalId}`}</span>}\n title={people ? 'No such user for you' : 'No such service account for you'}\n actions={\n <Link className=\"btn\" to={people ? '/users' : '/service-accounts'}>\n All {people ? 'users' : 'service accounts'}\n </Link>\n }\n >\n {report === null\n ? `A ${kind}'s page lists its access to the projects where you manage access, and you manage none.`\n : `No ${kind} by that name has ever been registered here.`}\n </ClosedDoor>\n );\n }\n\n const access = (\n <>\n {removed ? <Archive size={15} /> : <Folder size={15} />}\n {removed ? 'Offboarding' : 'Access'}\n </>\n );\n const activity = (\n <>\n <Activity size={15} />\n Activity\n </>\n );\n const tabs = people\n ? [\n <Link key=\"access\" to=\"/users/$user\" params={{ user: principalId }} activeOptions={{ exact: true, includeSearch: false }}>\n {access}\n </Link>,\n // Only an owner reads the report that lists them; removal disconnects them.\n hasAppsTab(shell, report) && mounted('/users/$user/apps') && (\n <Link key=\"apps\" to=\"/users/$user/apps\" params={{ user: principalId }}>\n <LinkIcon size={15} />\n Connected apps\n </Link>\n ),\n capabilities.canReadAudit && mounted('/users/$user/activity') && (\n <Link key=\"activity\" to=\"/users/$user/activity\" params={{ user: principalId }}>\n {activity}\n </Link>\n ),\n ]\n : [\n signInWays(shell, held) !== null && (\n <Link key=\"sign-in\" to=\"/service-accounts/$account\" params={{ account: principalId }} activeOptions={{ exact: true, includeSearch: false }}>\n <LinkIcon size={15} />\n Sign-in\n </Link>\n ),\n mounted('/service-accounts/$account/access') && (\n <Link key=\"access\" to=\"/service-accounts/$account/access\" params={{ account: principalId }}>\n {access}\n </Link>\n ),\n capabilities.canReadAudit && mounted('/service-accounts/$account/activity') && (\n <Link key=\"activity\" to=\"/service-accounts/$account/activity\" params={{ account: principalId }}>\n {activity}\n </Link>\n ),\n ];\n\n return (\n <>\n <PageHeader\n lead={<PrincipalAvatar type={principalType} id={principalId} size=\"lg\" />}\n title={principalType === 'service' ? `service:${principalId}` : principalId}\n description={\n principalType === 'service'\n ? 'A service account: an identity for CI and other automation.'\n : undefined\n }\n meta={\n removed ? (\n <span className=\"tag tag-red\">Removed</span>\n ) : (\n entry?.principalType === 'user' && <InstanceRole principal={entry} />\n )\n }\n actions={entry !== undefined && <PrincipalActions principal={entry} trigger=\"btn btn-icon\" />}\n />\n\n {change.state === 'failed' && (\n <div className=\"report-notice\">\n <ItemFailure status={change} onDismiss={() => dismiss(change.mutationId)} />\n </div>\n )}\n {report?.ok === false && (\n <div className=\"report-notice\">\n <Notice tone=\"bad\">{report.error}</Notice>\n </div>\n )}\n <PageTabs label={people ? 'User sections' : 'Service account sections'}>{tabs}</PageTabs>\n\n <Outlet />\n </>\n );\n}\n\n/**\n * A user's or service account's Access tab: its grants on every project\n * where you manage access, and on every project; once it is removed, what\n * its offboarding did instead.\n */\nexport function PrincipalAccess({ principalType, principalId }: { principalType: PrincipalType; principalId: string }) {\n const { instanceRole } = useShell();\n const report = useReport(principalType, principalId);\n const { access: held, error, projects: access, offers } = useMemberAccess(principalType, principalId);\n const kind = KIND[principalType];\n const people = principalType === 'user';\n const found = report?.ok === true ? report.report : null;\n const removed = found?.status === 'removed';\n\n // One request, so one error, said once in place of the rows (`UnreadAccess`).\n const rows = accessRows(access).flatMap((row) => (row.grant === null ? [] : [row]));\n // Grants to someone removed are refused until they are added back.\n const editable = removed\n ? []\n : access.filter(\n ({ project, grantsError }) => project.archivedAt === null && grantsError === null,\n );\n\n return (\n <>\n {removed && found !== null && <RemovedNotice report={found} />}\n\n {/* Removal ends every grant, so there is no access left to show. */}\n {!removed && (\n <>\n {people && held !== null && <InstanceRoleNote access={held} />}\n\n <section className=\"card\" aria-label=\"Project access\">\n {error !== null ? (\n <UnreadAccess member={memberRef(principalType, principalId)} error={error} />\n ) : rows.length === 0 ? (\n <EmptyState title=\"No project access yet\">\n {editable.length > 0\n ? `Edit access gives this ${kind} access to several projects at once.`\n : `None of the projects where you manage access has a grant for this ${kind}.`}\n </EmptyState>\n ) : (\n <GrantsTable\n lead={\n <span className=\"th\">\n <Folder size={14} />\n Project\n </span>\n }\n >\n {rows.map(({ project, grant }, index) => (\n <GrantRowView\n key={grant.id}\n number={index + 1}\n project={project.slug}\n grant={grant}\n leadLabel=\"Project\"\n lead={\n <span className=\"cell-project\">\n <Tile name={project.slug} />\n <Link\n className=\"cell-link\"\n to={people ? '/projects/$project/users' : '/projects/$project/service-accounts'}\n params={{ project: project.slug }}\n >\n {project.name}\n </Link>\n {project.archivedAt !== null && <span className=\"tag tag-red\">Archived</span>}\n </span>\n }\n />\n ))}\n </GrantsTable>\n )}\n </section>\n\n {editable.length > 0 && (\n <div className=\"table-actions\">\n <EditAccess principalType={principalType} principalId={principalId} access={editable} offers={offers} />\n </div>\n )}\n\n {/* A root admin manages every project, so nothing is out of view. */}\n {instanceRole !== 'root-admin' && (\n <p className=\"hint section-foot\">\n {held?.managed === true && principalType === 'service'\n ? 'Only projects where you may give it access are listed: what you hold there, where the instance lets you.'\n : 'Only projects where you manage access are listed.'}\n </p>\n )}\n\n </>\n )}\n\n {found !== null && <PrincipalReportCards report={found} />}\n </>\n );\n}\n\n/** What a person's instance role gives them, above the grants that add to it: nothing for a Member. */\nfunction InstanceRoleNote({ access }: { access: MemberAccess }) {\n if (access.instanceRole === 'member' || access.instanceRole === 'root-admin') return null;\n const { name } = INSTANCE_ROLES[access.instanceRole];\n return (\n <div className=\"report-notice\">\n <Notice tone=\"info\">\n <strong>{name}</strong>\n {access.scope === null ? '' : unscoped(access.scope) ? ' in every project' : `: ${scopeInWords(access.scope)}`}, from their instance role. The\n grants below add to it.\n </Notice>\n </div>\n );\n}\n\n/** Their access could not be read: why, and another try, never an empty list that reads as no access. */\nfunction UnreadAccess({ member, error }: { member: string; error: string }) {\n const queryClient = useQueryClient();\n const [retrying, setRetrying] = useState(false);\n return (\n <div className=\"row-failure-line unread-access\">\n <ErrorLine error={`Their access could not be read. ${error}`} />\n <button\n type=\"button\"\n className=\"act\"\n disabled={retrying}\n onClick={() => {\n setRetrying(true);\n void queryClient.refetchQueries({ queryKey: keys.memberAccess(member) }).finally(() => setRetrying(false));\n }}\n >\n {retrying && <Spinner size={13} />}\n Retry\n </button>\n </div>\n );\n}\n\n/**\n * One principal's access to every project you manage, edited in one place.\n *\n * Each project opens set to what the principal holds: a project-wide level,\n * or read or write per environment, each with its own expiry. Saving sends\n * only the difference, every project in one `access.set`: the server applies\n * all of it in one transaction, or none of it.\n */\nfunction EditAccess({\n principalType,\n principalId,\n access,\n offers,\n}: {\n principalType: PrincipalType;\n principalId: string;\n access: ProjectAccess[];\n offers: Offers;\n}) {\n const coffre = useCoffre();\n const [open, setOpen] = useState(false);\n const [edits, setEdits] = useState<Record<string, AccessPlan>>({});\n const { pending, error, setError, run } = useAction();\n const kind = KIND[principalType];\n\n const rows = access.map(({ project, grants }) => {\n const environments = project.environments\n .filter(\n (environment) => environment.details !== null && environment.details.archivedAt === null,\n )\n .map((environment) => environment.slug);\n const held = planFromGrants(grants, environments);\n const plan = Object.hasOwn(edits, project.slug) ? edits[project.slug] : held;\n // What you may give here: every role where you manage access; a service account you manage, what you hold.\n const whole = offers(project, null);\n const each = Object.fromEntries(environments.map((slug) => [slug, offers(project, slug)]));\n return { project, grants, environments, held, plan, whole, each, changes: accessChanges(grants, plan) };\n });\n const changed = rows.filter((row) => row.changes.length > 0);\n\n function close() {\n setOpen(false);\n setEdits({});\n setError(null);\n }\n\n return (\n <>\n <button className=\"btn btn-primary\" onClick={() => setOpen(true)}>\n <Pencil size={14} />\n Edit access\n </button>\n\n <Modal\n open={open}\n onOpenChange={(next) => (next ? setOpen(true) : close())}\n title={\n <>\n Edit access for <span className=\"mono\">{principalId}</span>\n </>\n }\n description={`Set what this ${kind} can reach on each project you ${principalType === 'service' ? 'may give it access to' : 'manage'}, and until when.`}\n wide\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n run(\n () =>\n coffre.access.set(\n memberRef(principalType, principalId),\n Object.assign({}, ...changed.map(({ project, changes }) => accessPatch(project.slug, changes))),\n ),\n {\n affects: changed.flatMap(({ project }) =>\n affects.access(project.slug, memberRef(principalType, principalId)),\n ),\n onSuccess: () => {\n toast.success(\n `Updated ${principalId}’s access on ${changed.length} project${changed.length === 1 ? '' : 's'}`,\n );\n close();\n },\n },\n );\n }}\n >\n <ul className=\"plan-list\">\n <li className=\"plan-head\" aria-hidden=\"true\">\n <span>Project</span>\n <span>Access</span>\n <span>Expires</span>\n </li>\n {rows.map(({ project, grants, environments, held, plan, whole, each, changes }) => {\n const id = `plan-${project.slug}`;\n const edit = (next: AccessPlan) =>\n setEdits((current) => ({ ...current, [project.slug]: next }));\n return (\n <li\n key={project.slug}\n className={`plan-row${changes.length > 0 ? ' is-changed' : ''}`}\n >\n <label className=\"plan-project\" htmlFor={id}>\n <Tile name={project.slug} />\n <span className=\"plan-project-text\">\n <span className=\"plan-project-name\">{project.name}</span>\n {held.level === 'custom' && (\n <span className=\"plan-project-held\">\n Holds {grants.map((grant) => projectAccessLabel(grant)).join(', ')}\n </span>\n )}\n </span>\n </label>\n <select\n id={id}\n className=\"select select-sm\"\n value={plan.level}\n onChange={(event) =>\n edit(\n withLevel(plan, event.target.value as AccessPlan['level'], environments),\n )\n }\n >\n {held.level === 'custom' && <option value=\"custom\">Keep as is</option>}\n <option value=\"none\">No access</option>\n {whole.includes('owner') && <option value=\"owner\">{ROLES.owner.name}</option>}\n {whole.includes('viewer') && <option value=\"viewer\">{ROLES.viewer.name}: all</option>}\n {whole.includes('developer') && <option value=\"developer\">{ROLES.developer.name}: all</option>}\n {environments.some((slug) => each[slug]!.length > 0) && <option value=\"env\">Per environment…</option>}\n </select>\n {(plan.level === 'owner' ||\n plan.level === 'viewer' ||\n plan.level === 'developer') && (\n <ExpiryField\n label={`${project.name} expires`}\n expiresAt={plan.expiresAt}\n onChange={(expiresAt) => edit({ ...plan, expiresAt })}\n />\n )}\n\n {plan.level === 'env' && (\n <ul className=\"plan-envs\" aria-label={`Environments of ${project.name}`}>\n {environments.map((slug) => {\n const current = environmentAccess(plan, slug);\n return (\n <li key={slug} className=\"plan-env\">\n <label className=\"mono\" htmlFor={`${id}-${slug}`}>\n {slug}\n </label>\n <select\n id={`${id}-${slug}`}\n className=\"select select-sm\"\n value={current?.role ?? ''}\n onChange={(event) => {\n const role = event.target.value;\n edit(\n withEnvironment(\n plan,\n slug,\n role === 'viewer' || role === 'developer'\n ? { role, expiresAt: current?.expiresAt ?? null }\n : null,\n ),\n );\n }}\n >\n <option value=\"\">No access</option>\n {each[slug]!.includes('viewer') && <option value=\"viewer\">{ROLES.viewer.name}</option>}\n {each[slug]!.includes('developer') && <option value=\"developer\">{ROLES.developer.name}</option>}\n </select>\n {current !== null && (\n <ExpiryField\n label={`${slug} of ${project.name} expires`}\n expiresAt={current.expiresAt}\n onChange={(expiresAt) =>\n edit(withEnvironment(plan, slug, { ...current, expiresAt }))\n }\n />\n )}\n </li>\n );\n })}\n </ul>\n )}\n\n {changes.length > 0 && (\n <ul className=\"plan-changes\" aria-label={`Changes to ${project.name}`}>\n {changes.map((change) => (\n <li\n key={\n change.kind === 'create'\n ? `+${change.role}@${change.environmentSlug ?? ''}`\n : change.grant.id\n }\n >\n <AccessChangeTag change={change} />\n </li>\n ))}\n </ul>\n )}\n </li>\n );\n })}\n </ul>\n\n <ErrorLine error={error} />\n\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={close}>\n Cancel\n </button>\n <button\n className=\"btn btn-primary\"\n type=\"submit\"\n disabled={pending || changed.length === 0}\n >\n {pending && <Spinner />}\n Save changes\n </button>\n </div>\n </form>\n </Modal>\n </>\n );\n}\n\nfunction AccessChangeTag({ change }: { change: AccessChange }) {\n const until = (expiresAt: string | null) =>\n expiresAt === null ? '' : ` until ${dateFromExpiry(expiresAt)}`;\n switch (change.kind) {\n case 'create':\n return (\n <span className=\"tag tag-green\">\n <span aria-hidden=\"true\">+</span>\n <span className=\"visually-hidden\">Adds</span>\n {projectAccessLabel({ ...change, roleName: change.role })}\n {until(change.expiresAt)}\n </span>\n );\n case 'expiry':\n return (\n <span className=\"tag tag-blue\">\n <Clock size={12} />\n <span className=\"visually-hidden\">Moves the expiry of</span>\n {projectAccessLabel(change.grant)}\n {change.expiresAt === null ? ', no expiry' : until(change.expiresAt)}\n </span>\n );\n case 'revoke':\n return (\n <span className=\"tag tag-red\">\n <span aria-hidden=\"true\">−</span>\n <span className=\"visually-hidden\">Removes</span>\n {projectAccessLabel(change.grant)}\n </span>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,IAAM,YAAY;;;;;;AAOlB,SAAgB,WAAW,EAAE,UAA8B;CACzD,MAAM,SAAS,UAAU;CACzB,MAAM,MAAM,iBAAiB;EAC3B,UAAU;GAAC,GAAG,KAAK;GAAO;GAAS;EAAM;EACzC,WAAW;EACX,kBAAkB,KAAA;EAClB,UAAU,EAAE,gBACV,eAAe,OAAO,MAAM,KAAK;GAAE,OAAO;GAAQ,OAAO;GAAW,QAAQ;EAAU,CAAC,CAAC;EAC1F,mBAAmB,SACjB,KAAK,MAAM,KAAK,QAAQ,WAAW,YAAY,KAAK,QAAQ,GAAG,EAAE,CAAC,CAAE,MAAM,KAAA;CAC9E,CAAC;CAED,IAAI,IAAI,WACN,OACE,qBAAC,KAAD;EAAG,WAAU;YAAb,CACE,oBAAC,SAAD,EAAS,MAAM,GAAK,CA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C5B;;CAEZ;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { u as useCoffre } from "./page-DvsgZ2Hd.js";
|
|
2
|
-
import {
|
|
2
|
+
import { g as queries, h as projectOf } from "./queries-DE5nK2y4.js";
|
|
3
3
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
4
4
|
//#region src/lib/project-page.ts
|
|
5
5
|
/**
|
|
@@ -14,4 +14,4 @@ function useProject(slug) {
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { useProject as t };
|
|
16
16
|
|
|
17
|
-
//# sourceMappingURL=project-page-
|
|
17
|
+
//# sourceMappingURL=project-page-B3TZ5_ig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-page-
|
|
1
|
+
{"version":3,"file":"project-page-B3TZ5_ig.js","names":[],"sources":["../../src/lib/project-page.ts"],"sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query';\n\nimport { useCoffre } from './coffre';\nimport { projectOf, queries } from './queries';\n\n/**\n * The project one of its tabs shows, as its layout found it: the layout\n * renders a tab only once the project is there for its visitor.\n */\nexport function useProject(slug: string) {\n const found = projectOf(useSuspenseQuery(queries.projects(useCoffre())).data, slug);\n if (!found.ok) throw new Error(`no project \"${slug}\" for this tab`);\n return found;\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,WAAW,MAAc;CACvC,MAAM,QAAQ,UAAU,iBAAiB,QAAQ,SAAS,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI;CAClF,IAAI,CAAC,MAAM,IAAI,MAAM,IAAI,MAAM,eAAe,KAAK,eAAe;CAClE,OAAO;AACT"}
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import { c as statusOf, l as uiResult, s as memberRef } from "./page-DvsgZ2Hd.js";
|
|
2
|
+
import { EVERYWHERE, INSTANCE_ROLES, administers, makesProjects } from "@coffre/core/access";
|
|
2
3
|
import { QueryClient, queryOptions } from "@tanstack/react-query";
|
|
3
4
|
//#region src/lib/capabilities.ts
|
|
4
5
|
var NONE = {
|
|
5
6
|
canManageGrants: false,
|
|
7
|
+
runsInstance: false,
|
|
8
|
+
setsUpServices: false,
|
|
6
9
|
canReadAudit: false,
|
|
7
10
|
canCreateProject: false
|
|
8
11
|
};
|
|
9
12
|
function deriveUiCapabilities(me, projects) {
|
|
10
13
|
if (me === null) return NONE;
|
|
11
|
-
const
|
|
14
|
+
const isRootAdmin = me.instanceRole === "root-admin";
|
|
15
|
+
const role = me.instanceRole === "root-admin" ? "owner" : me.instanceRole;
|
|
12
16
|
return {
|
|
13
|
-
canManageGrants:
|
|
17
|
+
canManageGrants: isRootAdmin || administers(role),
|
|
18
|
+
runsInstance: me.runsInstance,
|
|
19
|
+
setsUpServices: me.setsUpServices,
|
|
14
20
|
canReadAudit: me.canReadAudit,
|
|
15
|
-
canCreateProject:
|
|
21
|
+
canCreateProject: makesProjects({
|
|
22
|
+
isRootAdmin,
|
|
23
|
+
role,
|
|
24
|
+
scope: me.scope,
|
|
25
|
+
grants: []
|
|
26
|
+
})
|
|
16
27
|
};
|
|
17
28
|
}
|
|
18
29
|
/** Secret values are available only where the API reports secret.read. */
|
|
@@ -65,38 +76,52 @@ var keys = {
|
|
|
65
76
|
],
|
|
66
77
|
directory: ["directory"],
|
|
67
78
|
report: (member) => ["report", member],
|
|
79
|
+
memberAccess: (member) => ["member-access", member],
|
|
68
80
|
credentials: (member) => ["credentials", member],
|
|
69
81
|
bindings: (member) => ["bindings", member],
|
|
70
82
|
identities: ["identities"],
|
|
71
83
|
sessions: ["sessions"],
|
|
72
84
|
apps: ["apps"],
|
|
73
85
|
audit: ["audit"],
|
|
74
|
-
auditKeys: ["audit", "keys"]
|
|
86
|
+
auditKeys: ["audit", "keys"],
|
|
87
|
+
settings: ["settings"]
|
|
75
88
|
};
|
|
76
|
-
/**
|
|
89
|
+
/** Members' grants, as rows, and a row for each one whose instance role reaches the place listed. */
|
|
77
90
|
function grantRows(members) {
|
|
78
|
-
return members.flatMap((member) => member.
|
|
91
|
+
return members.flatMap((member) => [...member.reachesByRole && member.instanceRole !== "root-admin" ? [{
|
|
92
|
+
id: `${member.member}/instance-role`,
|
|
93
|
+
principalType: member.principalType,
|
|
94
|
+
principalId: member.principalId,
|
|
95
|
+
role: member.instanceRole,
|
|
96
|
+
roleName: INSTANCE_ROLES[member.instanceRole].name,
|
|
97
|
+
permissions: [...INSTANCE_ROLES[member.instanceRole].permissions],
|
|
98
|
+
scope: "instance-role",
|
|
99
|
+
environmentSlug: null,
|
|
100
|
+
expiresAt: null
|
|
101
|
+
}] : [], ...member.grants.map((grant) => ({
|
|
79
102
|
id: grant.id,
|
|
80
103
|
principalType: member.principalType,
|
|
81
104
|
principalId: member.principalId,
|
|
82
105
|
role: grant.role,
|
|
83
106
|
roleName: grant.roleName,
|
|
84
107
|
permissions: grant.permissions,
|
|
85
|
-
scope: grant.
|
|
108
|
+
scope: grant.environment === null ? "project" : "environment",
|
|
86
109
|
environmentSlug: grant.environment,
|
|
87
110
|
expiresAt: grant.expiresAt
|
|
88
|
-
})));
|
|
111
|
+
}))]);
|
|
89
112
|
}
|
|
90
113
|
function listDirectory(client) {
|
|
91
114
|
return uiResult(async () => {
|
|
92
115
|
const { members, removed } = await client.members.list();
|
|
93
116
|
return {
|
|
94
|
-
principals: members.map(({ principalType, principalId, instanceRole, isRootAdmin, tampered, grants }) => ({
|
|
117
|
+
principals: members.map(({ principalType, principalId, instanceRole, scope, isRootAdmin, tampered, managed, grants }) => ({
|
|
95
118
|
principalType,
|
|
96
119
|
principalId,
|
|
97
120
|
instanceRole,
|
|
121
|
+
scope,
|
|
98
122
|
isRootAdmin,
|
|
99
123
|
tampered,
|
|
124
|
+
managed,
|
|
100
125
|
grants: grants.map(({ project, environment }) => ({
|
|
101
126
|
project,
|
|
102
127
|
environment
|
|
@@ -151,18 +176,27 @@ var queries = {
|
|
|
151
176
|
}),
|
|
152
177
|
/**
|
|
153
178
|
* Everyone in the directory, and who was removed. The API shows grant
|
|
154
|
-
* managers the members of their projects; the directory pages
|
|
155
|
-
* owners'
|
|
179
|
+
* managers the members of their projects; the directory pages are admins'
|
|
180
|
+
* and owners', and asking for anyone else would only log a refusal, so
|
|
156
181
|
* nobody else is asked.
|
|
157
182
|
*/
|
|
158
183
|
directory: (client, owner) => queryOptions({
|
|
159
184
|
queryKey: [...keys.directory, { owner }],
|
|
160
185
|
queryFn: () => owner ? listDirectory(client) : Promise.resolve({
|
|
161
186
|
ok: false,
|
|
162
|
-
error: "Only owners
|
|
187
|
+
error: "Only admins and owners manage users, and service accounts are set up by those who hold access where the instance lets them.",
|
|
163
188
|
signedOut: false
|
|
164
189
|
})
|
|
165
190
|
}),
|
|
191
|
+
/**
|
|
192
|
+
* One member's instance role and scope, and the grants you manage, in one
|
|
193
|
+
* read: their page's Access tab. Null for whoever may list nobody, which
|
|
194
|
+
* asking would only log as a refusal.
|
|
195
|
+
*/
|
|
196
|
+
memberAccess: (client, member, allowed) => queryOptions({
|
|
197
|
+
queryKey: [...keys.memberAccess(member), { allowed }],
|
|
198
|
+
queryFn: () => allowed ? uiResult(() => client.members.access(member)) : Promise.resolve(null)
|
|
199
|
+
}),
|
|
166
200
|
/** What one member can reach and has seen; null for anyone but owners, who alone may ask. */
|
|
167
201
|
report: (client, member, owner) => queryOptions({
|
|
168
202
|
queryKey: [...keys.report(member), { owner }],
|
|
@@ -216,6 +250,11 @@ var queries = {
|
|
|
216
250
|
queryKey: [...keys.auditKeys, { allowed }],
|
|
217
251
|
queryFn: () => allowed ? uiResult(() => client.audit.keys()) : Promise.resolve(null)
|
|
218
252
|
}),
|
|
253
|
+
/** The instance's settings: null for anyone but those who run it, who alone may ask. */
|
|
254
|
+
settings: (client, allowed) => queryOptions({
|
|
255
|
+
queryKey: [...keys.settings, { allowed }],
|
|
256
|
+
queryFn: () => allowed ? uiResult(() => client.settings.get()) : Promise.resolve(null)
|
|
257
|
+
}),
|
|
219
258
|
/** A page of the log, as filtered: always read fresh. */
|
|
220
259
|
auditEntries: (client, search) => queryOptions({
|
|
221
260
|
queryKey: [
|
|
@@ -253,8 +292,9 @@ var queries = {
|
|
|
253
292
|
})
|
|
254
293
|
};
|
|
255
294
|
/**
|
|
256
|
-
* Whether the log holds, or why that is not known. Verifying is for
|
|
257
|
-
*
|
|
295
|
+
* Whether the log holds, or why that is not known. Verifying is for those
|
|
296
|
+
* who read the whole log (an Auditor, Admin or Owner whose scope narrows
|
|
297
|
+
* nothing, a root admin): anyone else reads their projects' part of it, and a part cannot be
|
|
258
298
|
* checked as a chain, so for them it is a fact about the page, not a fault.
|
|
259
299
|
*/
|
|
260
300
|
async function verifyChain(client) {
|
|
@@ -295,6 +335,8 @@ function shellOf(auth, me, projects) {
|
|
|
295
335
|
auth,
|
|
296
336
|
principal: me === null ? null : me.principal,
|
|
297
337
|
instanceRole: member?.instanceRole ?? null,
|
|
338
|
+
/** Where their instance role applies, projects by slug. */
|
|
339
|
+
scope: member?.scope ?? EVERYWHERE,
|
|
298
340
|
projects: listed,
|
|
299
341
|
capabilities: deriveUiCapabilities(member, listed),
|
|
300
342
|
registrationRequired: me !== null && !me.registered,
|
|
@@ -304,7 +346,11 @@ function shellOf(auth, me, projects) {
|
|
|
304
346
|
features: member?.features ?? {
|
|
305
347
|
mcp: null,
|
|
306
348
|
workloads: false
|
|
307
|
-
}
|
|
349
|
+
},
|
|
350
|
+
/** Every environment you hold something in, and what: what you may give a service account there (`givable`). */
|
|
351
|
+
environments: member?.environments ?? [],
|
|
352
|
+
/** Where you set up service accounts yourself, the instance's setting, projects by slug. */
|
|
353
|
+
serviceSetup: member?.serviceSetup ?? null
|
|
308
354
|
};
|
|
309
355
|
}
|
|
310
356
|
/**
|
|
@@ -346,10 +392,30 @@ async function loadDirectory(queryClient, client) {
|
|
|
346
392
|
const shell = await loadShell(queryClient, client);
|
|
347
393
|
return queryClient.fetchQuery(queries.directory(client, shell.capabilities.canManageGrants));
|
|
348
394
|
}
|
|
349
|
-
/** The instance's settings: the directory's counts, and what its keys are checked against. */
|
|
395
|
+
/** The instance's settings: the directory's counts, where people set up service accounts, and what its keys are checked against. */
|
|
350
396
|
async function loadSettings(queryClient, client) {
|
|
351
397
|
const shell = await loadShell(queryClient, client);
|
|
352
|
-
await Promise.all([
|
|
398
|
+
await Promise.all([
|
|
399
|
+
loadDirectory(queryClient, client),
|
|
400
|
+
queryClient.fetchQuery(queries.settings(client, shell.capabilities.runsInstance)),
|
|
401
|
+
queryClient.fetchQuery(queries.auditKeys(client, shell.capabilities.runsInstance))
|
|
402
|
+
]);
|
|
403
|
+
}
|
|
404
|
+
/** Whether the Service accounts page lists anyone: to admins and owners, and to whoever sets one up, those they manage. */
|
|
405
|
+
function listsServices(shell) {
|
|
406
|
+
return shell.capabilities.canManageGrants || shell.capabilities.setsUpServices;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* How the caller may have a service account sign in, from its list entry
|
|
410
|
+
* or its access: bearer tokens under coffre's own sign-in, trusted
|
|
411
|
+
* workloads where the deployment trusts them, each only for an account they
|
|
412
|
+
* manage.
|
|
413
|
+
*/
|
|
414
|
+
function waysFor(shell, managed) {
|
|
415
|
+
return {
|
|
416
|
+
tokens: managed && shell.auth.signin !== null,
|
|
417
|
+
workloads: managed && shell.features.workloads
|
|
418
|
+
};
|
|
353
419
|
}
|
|
354
420
|
/**
|
|
355
421
|
* The service accounts page: the directory, and each account's bindings and
|
|
@@ -359,46 +425,57 @@ async function loadSettings(queryClient, client) {
|
|
|
359
425
|
*/
|
|
360
426
|
async function loadServiceDirectory(queryClient, client) {
|
|
361
427
|
const shell = await loadShell(queryClient, client);
|
|
362
|
-
const directory = await
|
|
363
|
-
|
|
364
|
-
const trusts = shell.capabilities.canManageGrants && shell.features.workloads;
|
|
365
|
-
if (!directory.ok || !allowed) return directory;
|
|
428
|
+
const directory = await queryClient.fetchQuery(queries.directory(client, listsServices(shell)));
|
|
429
|
+
if (!directory.ok) return directory;
|
|
366
430
|
await Promise.all(directory.principals.filter((principal) => principal.principalType === "service").flatMap((principal) => {
|
|
367
431
|
const member = memberRef("service", principal.principalId);
|
|
368
|
-
|
|
432
|
+
const ways = waysFor(shell, principal.managed === true);
|
|
433
|
+
return [queryClient.fetchQuery(queries.credentials(client, member, ways.tokens)), queryClient.fetchQuery(queries.bindings(client, member, ways.workloads))];
|
|
369
434
|
}));
|
|
370
435
|
return directory;
|
|
371
436
|
}
|
|
372
|
-
/** Who a user or service account is to the instance, its pages' header: null to anyone
|
|
437
|
+
/** Who a user or service account is to the instance, its pages' header: null to anyone who does not run it. */
|
|
373
438
|
async function loadMember(queryClient, client, member) {
|
|
374
439
|
const shell = await loadShell(queryClient, client);
|
|
375
|
-
return queryClient.fetchQuery(queries.report(client, member, shell.capabilities.
|
|
440
|
+
return queryClient.fetchQuery(queries.report(client, member, shell.capabilities.runsInstance));
|
|
376
441
|
}
|
|
377
442
|
/**
|
|
378
|
-
* What a user's or service account's Access tab reads:
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* keeps this member's. Projects where you do not hold grant.manage are
|
|
382
|
-
* skipped rather than asked: the refusal would land in the audit log as a
|
|
383
|
-
* denial in your name.
|
|
443
|
+
* What a user's or service account's Access tab reads: their role, scope
|
|
444
|
+
* and the grants you manage, in one request, which the server answers in
|
|
445
|
+
* one query, however many projects they hold grants in.
|
|
384
446
|
*/
|
|
385
|
-
async function loadAccess(queryClient, client) {
|
|
447
|
+
async function loadAccess(queryClient, client, member) {
|
|
386
448
|
const shell = await loadShell(queryClient, client);
|
|
387
|
-
|
|
449
|
+
return queryClient.fetchQuery(queries.memberAccess(client, member, listsAccess(shell)));
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Whether the caller may ask what someone holds: admins and owners,
|
|
453
|
+
* whoever manages a project's access, and whoever sets up service accounts,
|
|
454
|
+
* of those they manage.
|
|
455
|
+
*/
|
|
456
|
+
function listsAccess(shell) {
|
|
457
|
+
return shell.capabilities.canManageGrants || shell.capabilities.setsUpServices || managedProjects(shell.projects).length > 0;
|
|
388
458
|
}
|
|
389
459
|
/**
|
|
390
460
|
* How a service account's page lets it sign in: bearer tokens under
|
|
391
461
|
* coffre's own sign-in, trusted workloads where the deployment trusts them.
|
|
392
|
-
* Null where it shows neither: to anyone
|
|
393
|
-
* that is not active, which can be
|
|
462
|
+
* Null where it shows neither: to anyone who does not manage it (its access
|
|
463
|
+
* says, `managed`), and for an account that is not active, which can be
|
|
464
|
+
* issued nothing.
|
|
394
465
|
*/
|
|
395
|
-
function signInWays(shell,
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
466
|
+
function signInWays(shell, access) {
|
|
467
|
+
const ways = waysFor(shell, access?.ok === true && access.managed && access.status === "active");
|
|
468
|
+
return ways.tokens || ways.workloads ? ways : null;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Whether a user has a Connected apps tab: for an owner, where the
|
|
472
|
+
* deployment serves MCP, and while the user is registered and not removed,
|
|
473
|
+
* since removal disconnects every app. The tab, and the route under it,
|
|
474
|
+
* both ask.
|
|
475
|
+
*/
|
|
476
|
+
function hasAppsTab(shell, report) {
|
|
477
|
+
const found = report?.ok === true ? report.report : null;
|
|
478
|
+
return Boolean(shell.features.mcp) && shell.capabilities.runsInstance && found !== null && found.status !== "removed";
|
|
402
479
|
}
|
|
403
480
|
function managedProjects(projects) {
|
|
404
481
|
return projects.filter((project) => project.permissions.includes("grant.manage"));
|
|
@@ -423,21 +500,11 @@ var affects = {
|
|
|
423
500
|
*/
|
|
424
501
|
access: (project, member) => [
|
|
425
502
|
keys.grants(project),
|
|
503
|
+
keys.memberAccess(member),
|
|
426
504
|
keys.report(member),
|
|
427
505
|
keys.projects,
|
|
428
506
|
keys.me
|
|
429
507
|
],
|
|
430
|
-
/**
|
|
431
|
-
* Someone's access on every project changed: every project's grants, which
|
|
432
|
-
* list it where it reaches, the list of them, their report, and what you
|
|
433
|
-
* can see, as it may be your own.
|
|
434
|
-
*/
|
|
435
|
-
everyProject: (member) => [
|
|
436
|
-
["grants"],
|
|
437
|
-
keys.projects,
|
|
438
|
-
keys.report(member),
|
|
439
|
-
keys.me
|
|
440
|
-
],
|
|
441
508
|
/** Someone let in: the directory. */
|
|
442
509
|
admission: () => [keys.directory],
|
|
443
510
|
/**
|
|
@@ -447,6 +514,7 @@ var affects = {
|
|
|
447
514
|
role: (member) => [
|
|
448
515
|
keys.directory,
|
|
449
516
|
keys.report(member),
|
|
517
|
+
keys.memberAccess(member),
|
|
450
518
|
keys.me,
|
|
451
519
|
keys.projects
|
|
452
520
|
],
|
|
@@ -454,9 +522,19 @@ var affects = {
|
|
|
454
522
|
removal: (member) => [
|
|
455
523
|
keys.directory,
|
|
456
524
|
keys.report(member),
|
|
525
|
+
keys.memberAccess(member),
|
|
457
526
|
["grants"],
|
|
458
527
|
keys.projects
|
|
459
528
|
],
|
|
529
|
+
/**
|
|
530
|
+
* Where people set up service accounts changed: the setting, and what you
|
|
531
|
+
* may do, which the directory and `/me` say.
|
|
532
|
+
*/
|
|
533
|
+
settings: () => [
|
|
534
|
+
keys.settings,
|
|
535
|
+
keys.me,
|
|
536
|
+
keys.directory
|
|
537
|
+
],
|
|
460
538
|
credentials: (member) => [keys.credentials(member)],
|
|
461
539
|
bindings: (member) => [keys.bindings(member)],
|
|
462
540
|
/** Unlinking an account also ends the sessions it signed in. */
|
|
@@ -473,6 +551,6 @@ async function refresh(queryClient, touched) {
|
|
|
473
551
|
await Promise.all([...touched, keys.audit].map((queryKey) => queryClient.invalidateQueries({ queryKey })));
|
|
474
552
|
}
|
|
475
553
|
//#endregion
|
|
476
|
-
export {
|
|
554
|
+
export { refresh as _, listsAccess as a, waysFor as b, loadDirectory as c, loadServiceDirectory as d, loadSettings as f, queries as g, projectOf as h, keys as i, loadMember as l, managedProjects as m, createQueryClient as n, listsServices as o, loadShell as p, hasAppsTab as r, loadAccess as s, affects as t, loadProject as u, shellOf as v, canRevealSecrets as x, signInWays as y };
|
|
477
555
|
|
|
478
|
-
//# sourceMappingURL=queries-
|
|
556
|
+
//# sourceMappingURL=queries-DE5nK2y4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries-DE5nK2y4.js","names":[],"sources":["../../src/lib/capabilities.ts","../../src/lib/queries.ts"],"sourcesContent":["import { administers, makesProjects, type InstanceRole } from '@coffre/core/access';\n\nimport type { Me, Permission, ProjectSummary } from '../shared/models';\n\n/**\n * The small set of instance-wide decisions the shell has to make.\n *\n * Resource-specific controls still use the permissions returned for that\n * project or environment. These are only the capabilities whose affordances\n * live outside one resource page.\n */\nexport type UiCapabilities = {\n /** Admins and owners, scoped or not, and root admins: the Users and Service accounts pages. */\n canManageGrants: boolean;\n /**\n * Admins and owners whose scope narrows nothing, and root admins: adding\n * and removing people and service accounts, instance roles, tokens and\n * trust bindings, offboarding reports, the instance's keys.\n */\n runsInstance: boolean;\n /**\n * Who sets up service accounts: those who run the instance, and a person\n * who holds access somewhere the instance's setting takes in. The Service\n * accounts page lists them the ones they manage.\n */\n setsUpServices: boolean;\n canReadAudit: boolean;\n canCreateProject: boolean;\n};\n\nconst NONE: UiCapabilities = {\n canManageGrants: false,\n runsInstance: false,\n setsUpServices: false,\n canReadAudit: false,\n canCreateProject: false,\n};\n\nexport function deriveUiCapabilities(\n me: Me | null,\n projects: readonly ProjectSummary[],\n): UiCapabilities {\n if (me === null) return NONE;\n\n const isRootAdmin = me.instanceRole === 'root-admin';\n const role: InstanceRole = me.instanceRole === 'root-admin' ? 'owner' : me.instanceRole;\n\n return {\n // Users and Service accounts list the instance's directory, for those\n // who manage access across projects. Project access managers keep their\n // grant controls on each project page.\n canManageGrants: isRootAdmin || administers(role),\n runsInstance: me.runsInstance,\n setsUpServices: me.setsUpServices,\n canReadAudit: me.canReadAudit,\n // A new project is one no `only` list names: as the server decides,\n // from the role and the scope, projects by slug.\n canCreateProject: makesProjects({ isRootAdmin, role, scope: me.scope, grants: [] }),\n };\n}\n\n/** Secret values are available only where the API reports secret.read. */\nexport function canRevealSecrets(permissions: readonly Permission[]): boolean {\n return permissions.includes('secret.read');\n}\n","import type { AuthInfo, CoffreClient, Member } from '@coffre/client';\nimport { EVERYWHERE, INSTANCE_ROLES } from '@coffre/core/access';\nimport { QueryClient, queryOptions, type QueryKey } from '@tanstack/react-query';\n\nimport { deriveUiCapabilities } from './capabilities.ts';\nimport { memberRef, statusOf, uiResult } from './coffre.ts';\nimport type { DirectoryPrincipal, GrantRow, Me, ProjectSummary } from '../shared/models';\n\n/**\n * Every read the pages make, cached by TanStack Query: one cache per request\n * on the server, whose reads the page carries to the browser's, and one in the\n * browser for the whole visit.\n *\n * How fresh a page is. A read is reused for `FRESH_MS`, refetched when the\n * window regains focus, and refetched at once by any change made here, which\n * names what it touches (`affects`), so your own changes always show.\n * Someone else's change shows within that window. Nothing is decided on a\n * cached read: the server authorizes every call, so a stale screen can offer\n * an action the server then refuses, never grant one. The audit log and the\n * chain's verification are the exception, read fresh on every visit: their\n * whole point is to be current.\n */\nexport const FRESH_MS = 10_000;\n\nexport function createQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: FRESH_MS,\n refetchOnWindowFocus: true,\n // A read either answers or says why it cannot (`uiResult`), so a\n // throw is a fault, and asking again would only repeat it.\n retry: false,\n },\n },\n });\n}\n\ntype Place = { project: string; environment: string };\n\n/**\n * The keys, which `affects` names too. A project's keys start with it, so\n * one invalidation covers everything read under it.\n */\nexport const keys = {\n me: ['me'],\n auth: ['auth'],\n projects: ['projects'],\n grants: (project: string) => ['grants', project],\n secrets: ({ project, environment }: Place) => ['secrets', project, environment],\n references: (path: string) => ['references', path],\n missing: ({ project, environment }: Place) => ['missing', project, environment],\n directory: ['directory'],\n report: (member: string) => ['report', member],\n memberAccess: (member: string) => ['member-access', member],\n credentials: (member: string) => ['credentials', member],\n bindings: (member: string) => ['bindings', member],\n identities: ['identities'],\n sessions: ['sessions'],\n apps: ['apps'],\n audit: ['audit'],\n auditKeys: ['audit', 'keys'],\n settings: ['settings'],\n} satisfies Record<string, QueryKey | ((...args: never[]) => QueryKey)>;\n\n/** Members' grants, as rows, and a row for each one whose instance role reaches the place listed. */\nfunction grantRows(members: Member[]): GrantRow[] {\n return members.flatMap((member): GrantRow[] => [\n ...(member.reachesByRole && member.instanceRole !== 'root-admin'\n ? [{\n id: `${member.member}/instance-role`,\n principalType: member.principalType,\n principalId: member.principalId,\n role: member.instanceRole,\n roleName: INSTANCE_ROLES[member.instanceRole].name,\n permissions: [...INSTANCE_ROLES[member.instanceRole].permissions],\n scope: 'instance-role' as const,\n environmentSlug: null,\n expiresAt: null,\n }]\n : []),\n ...member.grants.map((grant) => ({\n id: grant.id,\n principalType: member.principalType,\n principalId: member.principalId,\n role: grant.role,\n roleName: grant.roleName,\n permissions: grant.permissions,\n scope: grant.environment === null ? ('project' as const) : ('environment' as const),\n environmentSlug: grant.environment,\n expiresAt: grant.expiresAt,\n })),\n ]);\n}\n\nfunction listDirectory(client: CoffreClient) {\n return uiResult(async () => {\n const { members, removed } = await client.members.list();\n const principals: DirectoryPrincipal[] = members.map(\n ({ principalType, principalId, instanceRole, scope, isRootAdmin, tampered, managed, grants }) => ({\n principalType,\n principalId,\n instanceRole,\n scope,\n isRootAdmin,\n tampered,\n managed,\n grants: grants.map(({ project, environment }) => ({ project, environment })),\n }),\n );\n return { principals, removed };\n });\n}\n\nconst readProjects = (client: CoffreClient) => uiResult(() => client.projects.list());\n\n/** The projects you can see, or why they could not be listed. */\nexport type ProjectsResult = Awaited<ReturnType<typeof readProjects>>;\n\nexport type AuditSearch = { decision?: 'deny'; actorId?: string; detail?: '1' };\n\nexport const AUDIT_PAGE_SIZE = 200;\n\nexport const queries = {\n /** Who is looking; null when nobody is signed in. */\n me: (client: CoffreClient) =>\n queryOptions({\n queryKey: keys.me,\n queryFn: async (): Promise<Me | null> => {\n try {\n return await client.me();\n } catch (error) {\n if (statusOf(error) === 401) return null;\n throw error;\n }\n },\n }),\n\n /** How this instance signs people in. */\n auth: (client: CoffreClient) => queryOptions({ queryKey: keys.auth, queryFn: (): Promise<AuthInfo> => client.auth() }),\n\n /** The projects you can see, each with its distinct secret count. */\n projects: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.projects, queryFn: () => readProjects(client) }),\n\n /** Who holds what in a project, for those who manage its access. */\n grants: (client: CoffreClient, project: string) =>\n queryOptions({\n queryKey: keys.grants(project),\n queryFn: () => uiResult(async () => ({ grants: grantRows((await client.members.list(project)).members) })),\n }),\n\n secrets: (client: CoffreClient, place: Place) =>\n queryOptions({\n queryKey: keys.secrets(place),\n queryFn: () => uiResult(() => client.secrets.list(`${place.project}/${place.environment}`)),\n }),\n\n /** What an environment lacks of its siblings' keys, those you read, and what its team dismissed. */\n missing: (client: CoffreClient, place: Place) =>\n queryOptions({\n queryKey: keys.missing(place),\n queryFn: () => uiResult(() => client.environments.missing(`${place.project}/${place.environment}`)),\n }),\n\n /** The live references into and out of a place, and who reads through them, for whoever manages its access. */\n references: (client: CoffreClient, path: string) =>\n queryOptions({\n queryKey: keys.references(path),\n queryFn: () => uiResult(() => client.references.list(path)),\n }),\n\n /**\n * Everyone in the directory, and who was removed. The API shows grant\n * managers the members of their projects; the directory pages are admins'\n * and owners', and asking for anyone else would only log a refusal, so\n * nobody else is asked.\n */\n directory: (client: CoffreClient, owner: boolean) =>\n queryOptions({\n queryKey: [...keys.directory, { owner }],\n queryFn: () =>\n owner\n ? listDirectory(client)\n : Promise.resolve({\n ok: false as const,\n error: 'Only admins and owners manage users, and service accounts are set up by those who hold access where the instance lets them.',\n signedOut: false,\n }),\n }),\n\n /**\n * One member's instance role and scope, and the grants you manage, in one\n * read: their page's Access tab. Null for whoever may list nobody, which\n * asking would only log as a refusal.\n */\n memberAccess: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.memberAccess(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.members.access(member)) : Promise.resolve(null)),\n }),\n\n /** What one member can reach and has seen; null for anyone but owners, who alone may ask. */\n report: (client: CoffreClient, member: string, owner: boolean) =>\n queryOptions({\n queryKey: [...keys.report(member), { owner }],\n queryFn: () =>\n owner\n ? uiResult(async () => {\n try {\n return { report: await client.members.get(member) };\n } catch (error) {\n // No such member is an answer, not a failure.\n if (statusOf(error) === 404) return { report: null };\n throw error;\n }\n })\n : Promise.resolve(null),\n }),\n\n /**\n * A token's credentials; null where they cannot be listed. Only owners\n * issue and see them, and only coffre's own sign-in issues any.\n */\n credentials: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.credentials(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.tokens.list(member)) : Promise.resolve(null)),\n }),\n\n /**\n * A token's trust bindings: the CI runs that may sign in as it. Null for\n * anyone but an owner, and where the deployment trusts no workloads\n * (`features.workloads`), so there is nothing to ask.\n */\n bindings: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.bindings(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.bindings.list(member)) : Promise.resolve(null)),\n }),\n\n /** The accounts you sign in with, under coffre's own sign-in. */\n identities: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.identities, queryFn: () => uiResult(() => client.identities.list()) }),\n\n /** Where you are signed in, under coffre's own sign-in. */\n sessions: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.sessions, queryFn: () => uiResult(() => client.sessions.list()) }),\n /** The MCP clients I connected, where the deployment serves MCP (`features.mcp`). */\n apps: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.apps, queryFn: () => uiResult(() => client.apps.list()) }),\n\n /**\n * What the keys an operator keeps are checked against: the vault's ID and\n * the app key's fingerprint, no secret. Null for anyone but owners and root\n * admins, who alone may ask.\n */\n auditKeys: (client: CoffreClient, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.auditKeys, { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.audit.keys()) : Promise.resolve(null)),\n }),\n\n /** The instance's settings: null for anyone but those who run it, who alone may ask. */\n settings: (client: CoffreClient, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.settings, { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.settings.get()) : Promise.resolve(null)),\n }),\n\n /** A page of the log, as filtered: always read fresh. */\n auditEntries: (client: CoffreClient, search: AuditSearch) =>\n queryOptions({\n queryKey: [...keys.audit, 'entries', search],\n staleTime: 0,\n // Detail is left out by the server unless asked for, and counted.\n queryFn: () =>\n uiResult(() =>\n client.audit.list({\n limit: AUDIT_PAGE_SIZE,\n decision: search.decision,\n actor: search.actorId,\n detail: search.detail,\n }),\n ),\n }),\n\n /**\n * Whether the log holds: verified on every visit, and never waited for.\n * It re-reads the whole log, so it takes as long as the log is long; the\n * page shows the entries first and the verdict when it comes.\n */\n auditChain: (client: CoffreClient) =>\n queryOptions({ queryKey: [...keys.audit, 'chain'], staleTime: 0, queryFn: () => verifyChain(client) }),\n /** What deleting `market` or `market/prod` would take, asked afresh each time it is shown. */\n deletion: (client: CoffreClient, path: string) =>\n queryOptions({\n queryKey: ['deletion', path],\n staleTime: 0,\n gcTime: 0,\n queryFn: () =>\n uiResult(async () => {\n const { deletion } = path.includes('/')\n ? await client.environments.previewDelete(path)\n : await client.projects.previewDelete(path);\n return { deletion };\n }),\n }),\n};\n\n/**\n * Whether the log holds, or why that is not known. Verifying is for those\n * who read the whole log (an Auditor, Admin or Owner whose scope narrows\n * nothing, a root admin): anyone else reads their projects' part of it, and a part cannot be\n * checked as a chain, so for them it is a fact about the page, not a fault.\n */\nasync function verifyChain(client: CoffreClient) {\n try {\n const result = await client.audit.verify();\n return result.ok\n ? {\n integrity: 'intact' as const,\n through: result.through,\n entries: result.entries,\n checkpoint: result.checkpoint,\n pending: result.pending ?? 0,\n }\n : {\n integrity: 'broken' as const,\n through: result.through,\n failedAtSeq: result.failedAtSeq,\n author: result.author,\n reason: result.reason,\n };\n } catch (error) {\n const status = statusOf(error);\n if (status === 403) return { integrity: 'owners-only' as const };\n return {\n integrity: 'unknown' as const,\n problem: status === undefined ? 'the request never got an answer' : `the request failed with HTTP ${status}`,\n };\n }\n}\n\nexport type ChainResult = Awaited<ReturnType<typeof verifyChain>>;\n\n/**\n * Who is looking, how this instance signs people in, and the projects they\n * can see: what the shell needs on every screen. For someone signed out or\n * not yet a member the project list is refused, and they get the sign-in or\n * closed-door page.\n */\nexport function shellOf(\n auth: AuthInfo,\n me: Me | null,\n projects: ProjectsResult,\n) {\n const listed = projects.ok ? projects.projects : [];\n const member: Me | null = me?.registered === true ? me : null;\n return {\n auth,\n principal: me === null ? null : me.principal,\n instanceRole: member?.instanceRole ?? null,\n /** Where their instance role applies, projects by slug. */\n scope: member?.scope ?? EVERYWHERE,\n projects: listed,\n capabilities: deriveUiCapabilities(member, listed),\n registrationRequired: me !== null && !me.registered,\n /** A member the vault refuses: their record failed its integrity check. */\n accessTampered: me?.tampered === true,\n /** What the deployment's configuration turns on: MCP clients, as their endpoint's URL, and CI runs signing in by their ID tokens. */\n features: member?.features ?? { mcp: null, workloads: false },\n /** Every environment you hold something in, and what: what you may give a service account there (`givable`). */\n environments: member?.environments ?? [],\n /** Where you set up service accounts yourself, the instance's setting, projects by slug. */\n serviceSetup: member?.serviceSetup ?? null,\n };\n}\n\nexport type Shell = ReturnType<typeof shellOf>;\n\n/**\n * The shell, as every loader reads it: from the cache while fresh, so a\n * child route never asks again for what the root has.\n */\nexport async function loadShell(queryClient: QueryClient, client: CoffreClient): Promise<Shell> {\n const [auth, me, projects] = await Promise.all([\n queryClient.fetchQuery(queries.auth(client)),\n queryClient.fetchQuery(queries.me(client)),\n queryClient.fetchQuery(queries.projects(client)),\n ]);\n return shellOf(auth, me, projects);\n}\n\n/**\n * One project and, when you manage its access, its grants. A project that is\n * not there for you fails with no message: the page words that itself.\n */\nexport function projectOf(projects: ProjectsResult, slug: string) {\n if (!projects.ok) return projects;\n const project = projects.projects.find((entry) => entry.slug === slug);\n if (project === undefined) return { ok: false as const, error: null };\n return { ok: true as const, project, managesAccess: project.permissions.includes('grant.manage') };\n}\n\n/** What a project page reads: the project list, and its grants when you manage them. */\nexport async function loadProject(queryClient: QueryClient, client: CoffreClient, slug: string) {\n const found = projectOf(await queryClient.fetchQuery(queries.projects(client)), slug);\n if (found.ok && found.managesAccess) await queryClient.fetchQuery(queries.grants(client, slug));\n}\n\n/** The directory pages' read: the directory, for owners. */\nexport async function loadDirectory(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n return queryClient.fetchQuery(queries.directory(client, shell.capabilities.canManageGrants));\n}\n\n/** The instance's settings: the directory's counts, where people set up service accounts, and what its keys are checked against. */\nexport async function loadSettings(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n await Promise.all([\n loadDirectory(queryClient, client),\n queryClient.fetchQuery(queries.settings(client, shell.capabilities.runsInstance)),\n queryClient.fetchQuery(queries.auditKeys(client, shell.capabilities.runsInstance)),\n ]);\n}\n\n/** Whether the Service accounts page lists anyone: to admins and owners, and to whoever sets one up, those they manage. */\nexport function listsServices(shell: Shell): boolean {\n return shell.capabilities.canManageGrants || shell.capabilities.setsUpServices;\n}\n\n/**\n * How the caller may have a service account sign in, from its list entry\n * or its access: bearer tokens under coffre's own sign-in, trusted\n * workloads where the deployment trusts them, each only for an account they\n * manage.\n */\nexport function waysFor(shell: Shell, managed: boolean): { tokens: boolean; workloads: boolean } {\n return { tokens: managed && shell.auth.signin !== null, workloads: managed && shell.features.workloads };\n}\n\n/**\n * The service accounts page: the directory, and each account's bindings and\n * tokens, read here as its own page reads them, so the list shows how each\n * signs in from the first paint and the browser asks for nothing that may be\n * refused (a deployment that trusts no workloads answers bindings with one).\n */\nexport async function loadServiceDirectory(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n const directory = await queryClient.fetchQuery(queries.directory(client, listsServices(shell)));\n if (!directory.ok) return directory;\n await Promise.all(\n directory.principals\n .filter((principal) => principal.principalType === 'service')\n .flatMap((principal) => {\n const member = memberRef('service', principal.principalId);\n const ways = waysFor(shell, principal.managed === true);\n return [\n queryClient.fetchQuery(queries.credentials(client, member, ways.tokens)),\n queryClient.fetchQuery(queries.bindings(client, member, ways.workloads)),\n ];\n }),\n );\n return directory;\n}\n\n/** Who a user or service account is to the instance, its pages' header: null to anyone who does not run it. */\nexport async function loadMember(queryClient: QueryClient, client: CoffreClient, member: string) {\n const shell = await loadShell(queryClient, client);\n return queryClient.fetchQuery(queries.report(client, member, shell.capabilities.runsInstance));\n}\n\nexport type MemberReport = Awaited<ReturnType<typeof loadMember>>;\n\n/**\n * What a user's or service account's Access tab reads: their role, scope\n * and the grants you manage, in one request, which the server answers in\n * one query, however many projects they hold grants in.\n */\nexport async function loadAccess(queryClient: QueryClient, client: CoffreClient, member: string) {\n const shell = await loadShell(queryClient, client);\n return queryClient.fetchQuery(queries.memberAccess(client, member, listsAccess(shell)));\n}\n\n/**\n * Whether the caller may ask what someone holds: admins and owners,\n * whoever manages a project's access, and whoever sets up service accounts,\n * of those they manage.\n */\nexport function listsAccess(shell: Shell): boolean {\n return shell.capabilities.canManageGrants || shell.capabilities.setsUpServices || managedProjects(shell.projects).length > 0;\n}\n\nexport type MemberAccessResult = Awaited<ReturnType<typeof loadAccess>>;\n\n/**\n * How a service account's page lets it sign in: bearer tokens under\n * coffre's own sign-in, trusted workloads where the deployment trusts them.\n * Null where it shows neither: to anyone who does not manage it (its access\n * says, `managed`), and for an account that is not active, which can be\n * issued nothing.\n */\nexport function signInWays(shell: Shell, access: MemberAccessResult): { tokens: boolean; workloads: boolean } | null {\n const managed = access?.ok === true && access.managed && access.status === 'active';\n const ways = waysFor(shell, managed);\n return ways.tokens || ways.workloads ? ways : null;\n}\n\n/**\n * Whether a user has a Connected apps tab: for an owner, where the\n * deployment serves MCP, and while the user is registered and not removed,\n * since removal disconnects every app. The tab, and the route under it,\n * both ask.\n */\nexport function hasAppsTab(shell: Shell, report: MemberReport): boolean {\n const found = report?.ok === true ? report.report : null;\n return Boolean(shell.features.mcp) && shell.capabilities.runsInstance && found !== null && found.status !== 'removed';\n}\n\nexport function managedProjects(projects: ProjectSummary[]): ProjectSummary[] {\n return projects.filter((project) => project.permissions.includes('grant.manage'));\n}\n\n/**\n * What each change touches, which `useAction` refetches when it lands. Every\n * change also lands in the audit log, which is always read fresh.\n */\nexport const affects = {\n /** A project or environment made, renamed or archived: the tree, and where you hold access. */\n places: (): QueryKey[] => [keys.projects, keys.me],\n /** Secrets written, renamed, restored or archived: the environment and the counts. */\n secrets: (place: Place): QueryKey[] => [keys.secrets(place), keys.projects, ['references'], ['missing']],\n /**\n * Someone's access in a project changed: its grants, their report, and, as\n * it may be your own, what you can see.\n */\n access: (project: string, member: string): QueryKey[] => [\n keys.grants(project),\n keys.memberAccess(member),\n keys.report(member),\n keys.projects,\n keys.me,\n ],\n /** Someone let in: the directory. */\n admission: (): QueryKey[] => [keys.directory],\n /**\n * An instance role changed: the directory, their report, and, as it may be\n * your own, what you can see and do.\n */\n role: (member: string): QueryKey[] => [keys.directory, keys.report(member), keys.memberAccess(member), keys.me, keys.projects],\n /** Someone removed: the directory, their report, and every grant, which removal ends, those on every project too. */\n removal: (member: string): QueryKey[] => [keys.directory, keys.report(member), keys.memberAccess(member), ['grants'], keys.projects],\n /**\n * Where people set up service accounts changed: the setting, and what you\n * may do, which the directory and `/me` say.\n */\n settings: (): QueryKey[] => [keys.settings, keys.me, keys.directory],\n credentials: (member: string): QueryKey[] => [keys.credentials(member)],\n bindings: (member: string): QueryKey[] => [keys.bindings(member)],\n /** Unlinking an account also ends the sessions it signed in. */\n identities: (): QueryKey[] => [keys.identities, keys.sessions],\n sessions: (): QueryKey[] => [keys.sessions],\n apps: (): QueryKey[] => [keys.apps],\n};\n\n/**\n * Refetch what a change touched: at once where it is on screen, on next use\n * elsewhere. Every change lands in the audit log, so the log and its\n * verification are always among them.\n */\nexport async function refresh(queryClient: QueryClient, touched: QueryKey[]): Promise<void> {\n await Promise.all([...touched,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B;EACvD,KAAK,OAAO,OAAO;EACnB,KAAK,aAAa,MAAM;EACxB,KAAK,OAAO,MAAM;EAClB,KAAK;EACL,KAAK;CACP;;CAEA,iBAA6B,CAAC,KAAK,SAAS;;;;;CAK5C,OAAO,WAA+B;EAAC,KAAK;EAAW,KAAK,OAAO,MAAM;EAAG,KAAK,aAAa,MAAM;EAAG,KAAK;EAAI,KAAK;CAAQ;;CAE7H,UAAU,WAA+B;EAAC,KAAK;EAAW,KAAK,OAAO,MAAM;EAAG,KAAK,aAAa,MAAM;EAAG,CAAC,QAAQ;EAAG,KAAK;CAAQ;;;;;CAKnI,gBAA4B;EAAC,KAAK;EAAU,KAAK;EAAI,KAAK;CAAS;CACnE,cAAc,WAA+B,CAAC,KAAK,YAAY,MAAM,CAAC;CACtE,WAAW,WAA+B,CAAC,KAAK,SAAS,MAAM,CAAC;;CAEhE,kBAA8B,CAAC,KAAK,YAAY,KAAK,QAAQ;CAC7D,gBAA4B,CAAC,KAAK,QAAQ;CAC1C,YAAwB,CAAC,KAAK,IAAI;AACpC;;;;;;AAOA,eAAsB,QAAQ,aAA0B,SAAoC;CAC1F,MAAM,QAAQ,IAAI,CAAC,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,KAAK,aAAa,YAAY,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC;AAC3G"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { a as ErrorLine, c as Notice, n as ConfirmDialog, s as Modal, u as Timestamp } from "./ui-DJje3gST.js";
|
|
2
2
|
import { g as ArrowRight, t as Card, u as useCoffre } from "./page-DvsgZ2Hd.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { g as queries } from "./queries-DE5nK2y4.js";
|
|
4
|
+
import { i as secretKeyProblem } from "./validation-DiHIwZRA.js";
|
|
5
|
+
import { t as useAction } from "./use-action-BRgvbUWt.js";
|
|
5
6
|
import { useEffect, useId, useState } from "react";
|
|
6
7
|
import { Link } from "@tanstack/react-router";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -340,4 +341,4 @@ function ArchiveBlocked({ references }) {
|
|
|
340
341
|
//#endregion
|
|
341
342
|
export { ReferencesInto as a, ReferenceValue as i, LentReferences as n, archiveBlockers as o, MakeReference as r, referenceProblem as s, ArchiveBlocked as t };
|
|
342
343
|
|
|
343
|
-
//# sourceMappingURL=references-
|
|
344
|
+
//# sourceMappingURL=references-uv4Mli9z.js.map
|