@coffre/ui 0.9.0 → 0.10.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/{audit-sentence-JrQIUq6j.js → audit-sentence-DpYySuqg.js} +74 -7
- package/dist/chunks/audit-sentence-DpYySuqg.js.map +1 -0
- package/dist/chunks/{connected-apps-Dr8UgjK7.js → connected-apps-D48SFJsG.js} +4 -4
- package/dist/chunks/{connected-apps-Dr8UgjK7.js.map → connected-apps-D48SFJsG.js.map} +1 -1
- package/dist/chunks/{delete-place-CQCDHkne.js → delete-place-Cg_M6rAq.js} +4 -4
- package/dist/chunks/{delete-place-CQCDHkne.js.map → delete-place-Cg_M6rAq.js.map} +1 -1
- package/dist/chunks/{directory-XcSbDRJv.js → directory-_LTgdiIM.js} +11 -9
- package/dist/chunks/directory-_LTgdiIM.js.map +1 -0
- package/dist/chunks/{folders-Dw240WMJ.js → folders-D3A1NGpt.js} +2 -2
- package/dist/chunks/{folders-Dw240WMJ.js.map → folders-D3A1NGpt.js.map} +1 -1
- package/dist/chunks/{grants-CmdZjKYU.js → grants-CNM913EY.js} +6 -6
- package/dist/chunks/{grants-CmdZjKYU.js.map → grants-CNM913EY.js.map} +1 -1
- package/dist/chunks/{multi-combobox-CsIXihuc.js → multi-combobox-B0JzP1QN.js} +2 -2
- package/dist/chunks/{multi-combobox-CsIXihuc.js.map → multi-combobox-B0JzP1QN.js.map} +1 -1
- package/dist/chunks/{offboarding-CrgwaetA.js → offboarding-BeaNM3sf.js} +3 -3
- package/dist/chunks/{offboarding-CrgwaetA.js.map → offboarding-BeaNM3sf.js.map} +1 -1
- package/dist/chunks/{personal-tokens-Dvl1FktE.js → personal-tokens-KsXajpx4.js} +4 -4
- package/dist/chunks/{personal-tokens-Dvl1FktE.js.map → personal-tokens-KsXajpx4.js.map} +1 -1
- package/dist/chunks/{principal-page-bOaEYWJB.js → principal-page-BaiZXh6D.js} +94 -78
- package/dist/chunks/principal-page-BaiZXh6D.js.map +1 -0
- package/dist/chunks/{project-page-BI--vjt3.js → project-page-CYZ_MkfX.js} +2 -2
- package/dist/chunks/{project-page-BI--vjt3.js.map → project-page-CYZ_MkfX.js.map} +1 -1
- package/dist/chunks/protected-BL_DsZO6.js +22 -0
- package/dist/chunks/protected-BL_DsZO6.js.map +1 -0
- package/dist/chunks/{queries-epz4MIuW.js → queries-Danu0o75.js} +99 -31
- package/dist/chunks/queries-Danu0o75.js.map +1 -0
- package/dist/chunks/{references-DImfw0cz.js → references-BK2aPXae.js} +4 -4
- package/dist/chunks/{references-DImfw0cz.js.map → references-BK2aPXae.js.map} +1 -1
- package/dist/chunks/{role-field-C1KhNaIR.js → role-field-DIJiRz9B.js} +8 -5
- package/dist/chunks/role-field-DIJiRz9B.js.map +1 -0
- package/dist/chunks/{row-state-BsIHspy4.js → row-state-xtRGFnDc.js} +2 -2
- package/dist/chunks/{row-state-BsIHspy4.js.map → row-state-xtRGFnDc.js.map} +1 -1
- package/dist/chunks/{theme-3b4DnCow.js → theme-Ck45wzWB.js} +2 -2
- package/dist/chunks/{theme-3b4DnCow.js.map → theme-Ck45wzWB.js.map} +1 -1
- package/dist/chunks/{ui-2kwXXfrX.js → ui-D-blFWfx.js} +29 -5
- package/dist/chunks/{ui-2kwXXfrX.js.map → ui-D-blFWfx.js.map} +1 -1
- package/dist/chunks/{use-action-BB-RcHo1.js → use-action-BafZVwux.js} +2 -2
- package/dist/chunks/{use-action-BB-RcHo1.js.map → use-action-BafZVwux.js.map} +1 -1
- package/dist/chunks/{use-change-BY6KPmnJ.js → use-change-DhV6i_Ge.js} +218 -101
- package/dist/chunks/use-change-DhV6i_Ge.js.map +1 -0
- package/dist/chunks/use-roles-Daje0ikO.js +224 -0
- package/dist/chunks/use-roles-Daje0ikO.js.map +1 -0
- package/dist/chunks/{use-shell-C_NmvCt_.js → use-shell-BX9mzfaL.js} +2 -2
- package/dist/chunks/{use-shell-C_NmvCt_.js.map → use-shell-BX9mzfaL.js.map} +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +29 -15
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +9 -9
- package/dist/pages/approval.js +1 -1
- package/dist/pages/audit.js +96 -34
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +1 -1
- package/dist/pages/environment.js +255 -115
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +2 -2
- package/dist/pages/oauth-authorize.js +1 -1
- package/dist/pages/project-access.js +79 -46
- package/dist/pages/project-access.js.map +1 -1
- package/dist/pages/project-environments.js +79 -30
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.js +7 -7
- package/dist/pages/project.js +2 -2
- package/dist/pages/projects.js +26 -14
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +22 -15
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +4 -4
- package/dist/pages/settings.js +580 -8
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.js +1 -1
- package/dist/pages/user.js +5 -5
- package/dist/pages/users.js +4 -4
- package/package.json +3 -3
- package/src/components/directory.tsx +5 -2
- package/src/components/grants.tsx +1 -1
- package/src/components/principal-page.tsx +38 -23
- package/src/components/protected.tsx +17 -0
- package/src/components/role-editor.tsx +582 -0
- package/src/components/role-field.tsx +7 -3
- package/src/components/scope-picker.tsx +19 -9
- package/src/components/shell.tsx +7 -1
- package/src/components/ui.tsx +25 -2
- package/src/lib/access-plan.ts +35 -36
- package/src/lib/audit-sentences.ts +75 -9
- package/src/lib/changes.ts +46 -8
- package/src/lib/project-access.ts +4 -78
- package/src/lib/queries.ts +97 -29
- package/src/lib/roles.ts +201 -0
- package/src/lib/row-reads.ts +12 -0
- package/src/lib/secret-edit-batch.ts +147 -56
- package/src/lib/sensitivity.ts +50 -0
- package/src/lib/service-setup.ts +20 -8
- package/src/lib/use-roles.ts +17 -0
- package/src/options.ts +2 -3
- package/src/pages/audit.tsx +99 -26
- package/src/pages/environment.tsx +264 -101
- package/src/pages/project-access.tsx +49 -19
- package/src/pages/project-environments.tsx +62 -3
- package/src/pages/projects.tsx +3 -1
- package/src/pages/settings.tsx +2 -0
- package/src/parity.ts +42 -5
- package/src/shared/models.ts +2 -9
- package/src/styles/globals.css +322 -25
- package/dist/chunks/audit-sentence-JrQIUq6j.js.map +0 -1
- package/dist/chunks/directory-XcSbDRJv.js.map +0 -1
- package/dist/chunks/principal-page-bOaEYWJB.js.map +0 -1
- package/dist/chunks/queries-epz4MIuW.js.map +0 -1
- package/dist/chunks/role-field-C1KhNaIR.js.map +0 -1
- package/dist/chunks/use-change-BY6KPmnJ.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, type ReactNode } from 'react';
|
|
1
|
+
import { useId, useState, type ReactNode } from 'react';
|
|
2
2
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
3
3
|
import { useShell } from '../lib/use-shell';
|
|
4
4
|
import { useCoffre } from '../lib/coffre';
|
|
@@ -12,7 +12,8 @@ import { GrantRowView, GrantsTable, RefusedGrants, useRefusedGrants } from '../c
|
|
|
12
12
|
import { KIND } from '../components/directory';
|
|
13
13
|
import { PrincipalLink } from '../components/principal';
|
|
14
14
|
import { PrincipalPicker } from '../components/principal-picker';
|
|
15
|
-
import {
|
|
15
|
+
import { roleNameOf } from '../lib/roles';
|
|
16
|
+
import { useRoles } from '../lib/use-roles';
|
|
16
17
|
import { Key, Plus, User } from '../components/icons';
|
|
17
18
|
import { pageRoute } from '../lib/page-route';
|
|
18
19
|
import { useProject } from '../lib/project-page';
|
|
@@ -121,10 +122,18 @@ function NewGrant({
|
|
|
121
122
|
const [principalId, setPrincipalId] = useState('');
|
|
122
123
|
// A new service account, named in the picker: the grant makes it.
|
|
123
124
|
const [admit, setAdmit] = useState(false);
|
|
124
|
-
const [
|
|
125
|
+
const [role, setRole] = useState('viewer');
|
|
126
|
+
// '' for the whole project, else an environment's slug.
|
|
127
|
+
const [where, setWhere] = useState('');
|
|
125
128
|
const [expiresAt, setExpiresAt] = useState('');
|
|
126
129
|
const grant = useChange(grantAccess(useCoffre(), project));
|
|
127
|
-
const
|
|
130
|
+
const { roles } = useRoles();
|
|
131
|
+
const hint = useId();
|
|
132
|
+
const chosen = roles.find((each) => each.id === role);
|
|
133
|
+
// Live environments only: an archived one serves nothing to grant.
|
|
134
|
+
const live = environments.filter((environment) => environment.details !== null && environment.details.archivedAt === null);
|
|
135
|
+
// A role that holds something project-wide is granted on the project alone.
|
|
136
|
+
const onProjectOnly = chosen !== undefined && !chosen.assignableToEnvironment;
|
|
128
137
|
const kind = KIND[principalType];
|
|
129
138
|
const service = principalType === 'service';
|
|
130
139
|
|
|
@@ -134,7 +143,8 @@ function NewGrant({
|
|
|
134
143
|
setPrincipalId('');
|
|
135
144
|
setAdmit(false);
|
|
136
145
|
setExpiresAt('');
|
|
137
|
-
|
|
146
|
+
setRole('viewer');
|
|
147
|
+
setWhere('');
|
|
138
148
|
}
|
|
139
149
|
|
|
140
150
|
return (
|
|
@@ -153,20 +163,19 @@ function NewGrant({
|
|
|
153
163
|
</>
|
|
154
164
|
}
|
|
155
165
|
wide
|
|
156
|
-
description="
|
|
166
|
+
description="A role on the whole project, or on one of its environments. Owners manage the whole project and its access."
|
|
157
167
|
>
|
|
158
168
|
<form
|
|
159
169
|
className="form"
|
|
160
170
|
onSubmit={(event) => {
|
|
161
171
|
event.preventDefault();
|
|
162
|
-
const access = parseProjectAccess(permission);
|
|
163
172
|
// Shown in the list at once, marked as saving; the list says if the server refuses.
|
|
164
173
|
grant({
|
|
165
174
|
principalType,
|
|
166
175
|
principalId: principalId.trim(),
|
|
167
|
-
role
|
|
168
|
-
roleName:
|
|
169
|
-
environmentSlug:
|
|
176
|
+
role,
|
|
177
|
+
roleName: roleNameOf(roles, role),
|
|
178
|
+
environmentSlug: onProjectOnly || where === '' ? null : where,
|
|
170
179
|
expiresAt: expiresAt === '' ? null : new Date(`${expiresAt}T23:59:59Z`).toISOString(),
|
|
171
180
|
admit,
|
|
172
181
|
});
|
|
@@ -187,21 +196,35 @@ function NewGrant({
|
|
|
187
196
|
/>
|
|
188
197
|
|
|
189
198
|
<div className="form-row">
|
|
190
|
-
<label className="field"
|
|
191
|
-
<span className="label">
|
|
199
|
+
<label className="field">
|
|
200
|
+
<span className="label">Role</span>
|
|
201
|
+
<select className="select" value={role} onChange={(event) => setRole(event.target.value)}>
|
|
202
|
+
{roles.map((each) => (
|
|
203
|
+
<option key={each.id} value={each.id}>
|
|
204
|
+
{each.name}
|
|
205
|
+
</option>
|
|
206
|
+
))}
|
|
207
|
+
</select>
|
|
208
|
+
</label>
|
|
209
|
+
|
|
210
|
+
<label className="field">
|
|
211
|
+
<span className="label">On</span>
|
|
192
212
|
<select
|
|
193
213
|
className="select"
|
|
194
|
-
value={
|
|
195
|
-
|
|
214
|
+
value={onProjectOnly ? '' : where}
|
|
215
|
+
disabled={onProjectOnly}
|
|
216
|
+
aria-describedby={hint}
|
|
217
|
+
onChange={(event) => setWhere(event.target.value)}
|
|
196
218
|
>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
219
|
+
<option value="">The whole project</option>
|
|
220
|
+
{live.map((environment) => (
|
|
221
|
+
<option key={environment.slug} value={environment.slug}>
|
|
222
|
+
{environment.slug}
|
|
223
|
+
{environment.protected ? ' (protected)' : ''}
|
|
200
224
|
</option>
|
|
201
225
|
))}
|
|
202
226
|
</select>
|
|
203
227
|
</label>
|
|
204
|
-
|
|
205
228
|
<label className="field">
|
|
206
229
|
<span className="label">
|
|
207
230
|
Expires <span className="hint">(optional)</span>
|
|
@@ -215,11 +238,18 @@ function NewGrant({
|
|
|
215
238
|
</label>
|
|
216
239
|
</div>
|
|
217
240
|
|
|
241
|
+
{chosen !== undefined && (
|
|
242
|
+
<p className="hint" id={hint}>
|
|
243
|
+
{chosen.description}
|
|
244
|
+
{onProjectOnly && ' It holds something project-wide, so it is granted on the whole project.'}
|
|
245
|
+
</p>
|
|
246
|
+
)}
|
|
247
|
+
|
|
218
248
|
<div className="dialog-actions">
|
|
219
249
|
<button className="btn" type="button" onClick={close}>
|
|
220
250
|
Cancel
|
|
221
251
|
</button>
|
|
222
|
-
<button className="btn btn-primary" type="submit" disabled={principalId.trim() === ''}>
|
|
252
|
+
<button className="btn btn-primary" type="submit" disabled={principalId.trim() === '' || chosen === undefined}>
|
|
223
253
|
{admit ? 'Create and grant access' : 'Grant access'}
|
|
224
254
|
</button>
|
|
225
255
|
</div>
|
|
@@ -6,7 +6,7 @@ import { useShell } from '../lib/use-shell';
|
|
|
6
6
|
import { Menu } from '@base-ui/react/menu';
|
|
7
7
|
import { toast } from 'sonner';
|
|
8
8
|
import { useCoffre } from '../lib/coffre';
|
|
9
|
-
import { archiveEnvironment, createEnvironment, environmentId, renameEnvironment } from '../lib/changes';
|
|
9
|
+
import { archiveEnvironment, createEnvironment, environmentId, protectEnvironment, renameEnvironment } from '../lib/changes';
|
|
10
10
|
import { affects, keys, queries } from '../lib/queries';
|
|
11
11
|
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
12
12
|
import { ItemFailure, RowPending, rowClass } from '../components/row-state';
|
|
@@ -19,7 +19,10 @@ import { Card } from '../components/page';
|
|
|
19
19
|
import { useAction } from '../lib/use-action';
|
|
20
20
|
import { DeletePlaceDialog } from '../components/delete-place';
|
|
21
21
|
import { PrincipalAvatar } from '../components/principal';
|
|
22
|
-
import { Archive, ChevronRight, MoreHorizontal, Pencil, Plus, RotateBack, Trash } from '../components/icons';
|
|
22
|
+
import { Archive, ChevronRight, Lock, MoreHorizontal, Pencil, Plus, RotateBack, Trash } from '../components/icons';
|
|
23
|
+
import { ProtectedTag } from '../components/protected';
|
|
24
|
+
import { protectionInWords } from '../lib/roles';
|
|
25
|
+
import { useRoles } from '../lib/use-roles';
|
|
23
26
|
import { pageRoute } from '../lib/page-route';
|
|
24
27
|
import { useProject } from '../lib/project-page';
|
|
25
28
|
import type { projectEnvironments } from '../options';
|
|
@@ -108,6 +111,7 @@ function EnvironmentsPanel({
|
|
|
108
111
|
project={project.slug}
|
|
109
112
|
// Your personal config is nobody's source: its values are yours alone.
|
|
110
113
|
sources={current.filter((environment) => isActiveAccessibleEnvironment(environment) && !environment.personal).map((environment) => environment.slug)}
|
|
114
|
+
guarded={current.filter((environment) => environment.protected).map((environment) => environment.slug)}
|
|
111
115
|
/>
|
|
112
116
|
</div>
|
|
113
117
|
)}
|
|
@@ -183,11 +187,15 @@ function EnvironmentCard({
|
|
|
183
187
|
const [renaming, setRenaming] = useState(false);
|
|
184
188
|
const [confirming, setConfirming] = useState(false);
|
|
185
189
|
const [deleting, setDeleting] = useState(false);
|
|
190
|
+
// Protecting, or taking it off, waiting for its confirmation.
|
|
191
|
+
const [guarding, setGuarding] = useState(false);
|
|
186
192
|
const { capabilities } = useShell();
|
|
193
|
+
const { roles } = useRoles();
|
|
187
194
|
const [slug, setSlug] = useState(environment.slug);
|
|
188
195
|
const coffre = useCoffre();
|
|
189
196
|
const rename = useChange(renameEnvironment(coffre, project));
|
|
190
197
|
const archive = useChange(archiveEnvironment(coffre, project));
|
|
198
|
+
const protect = useChange(protectEnvironment(coffre, project));
|
|
191
199
|
// What archiving it would stop, asked once the dialog opens (D41); Archive waits for the answer.
|
|
192
200
|
const place = `${project}/${environment.slug}`;
|
|
193
201
|
const archiving = confirming && environment.details?.archivedAt == null;
|
|
@@ -204,6 +212,10 @@ function EnvironmentCard({
|
|
|
204
212
|
const manageable = isAdmin && details !== null;
|
|
205
213
|
// Deleting is for those who run the instance, and only once the environment is archived.
|
|
206
214
|
const deletable = manageable && isArchived && capabilities.runsInstance;
|
|
215
|
+
// Whoever manages environments protects one; only an Owner of the whole instance takes it off.
|
|
216
|
+
const guarded = environment.protected;
|
|
217
|
+
const guardable = manageable && environment.personal !== true && (!guarded || capabilities.ownsInstance);
|
|
218
|
+
const protection = protectionInWords(roles);
|
|
207
219
|
const slugError = slug === '' ? null : environmentSlugProblem(slug);
|
|
208
220
|
const lastChange = useLastChange(project, environment.slug, opens);
|
|
209
221
|
// A personal config is its owner's alone: no grant reaches it, so none is shown on its card.
|
|
@@ -228,6 +240,7 @@ function EnvironmentCard({
|
|
|
228
240
|
) : (
|
|
229
241
|
<span className="env-card-name">{environment.slug}</span>
|
|
230
242
|
)}
|
|
243
|
+
{guarded && <ProtectedTag />}
|
|
231
244
|
{/* A fork: its keys are its parent's, but for those it sets or removes. An instance before 0.7 says nothing. */}
|
|
232
245
|
{environment.personal === true
|
|
233
246
|
? <span className="tag tag-blue">yours alone</span>
|
|
@@ -301,6 +314,12 @@ function EnvironmentCard({
|
|
|
301
314
|
<Pencil size={14} />
|
|
302
315
|
Rename
|
|
303
316
|
</Menu.Item>
|
|
317
|
+
{guardable && (
|
|
318
|
+
<Menu.Item className="menu-item" onClick={() => setGuarding(true)}>
|
|
319
|
+
<Lock size={14} />
|
|
320
|
+
{guarded ? 'Unprotect…' : 'Protect…'}
|
|
321
|
+
</Menu.Item>
|
|
322
|
+
)}
|
|
304
323
|
<Menu.Separator className="menu-sep" />
|
|
305
324
|
<Menu.Item
|
|
306
325
|
className={`menu-item${isArchived ? '' : ' menu-item-danger'}`}
|
|
@@ -423,6 +442,32 @@ function EnvironmentCard({
|
|
|
423
442
|
</>
|
|
424
443
|
)}
|
|
425
444
|
|
|
445
|
+
{guardable && (
|
|
446
|
+
<ConfirmDialog
|
|
447
|
+
open={guarding}
|
|
448
|
+
onOpenChange={setGuarding}
|
|
449
|
+
title={
|
|
450
|
+
<>
|
|
451
|
+
{guarded ? 'Unprotect' : 'Protect'}{' '}
|
|
452
|
+
<span className="mono">
|
|
453
|
+
{project}/{environment.slug}
|
|
454
|
+
</span>
|
|
455
|
+
?
|
|
456
|
+
</>
|
|
457
|
+
}
|
|
458
|
+
body={
|
|
459
|
+
guarded
|
|
460
|
+
? 'People holding a role here get its full column again, as in any other environment. Service accounts are unaffected.'
|
|
461
|
+
: `People holding a role here get its protected column${protection === null ? ', which for now holds what the other does' : `: ${protection}`}. Service accounts are unaffected.${
|
|
462
|
+
capabilities.ownsInstance ? '' : ' Only an Owner of the whole instance takes protection off.'
|
|
463
|
+
}`
|
|
464
|
+
}
|
|
465
|
+
confirmLabel={guarded ? 'Unprotect' : 'Protect'}
|
|
466
|
+
destructive={guarded}
|
|
467
|
+
onConfirm={() => protect({ slug: environment.slug, protected: !guarded })}
|
|
468
|
+
/>
|
|
469
|
+
)}
|
|
470
|
+
|
|
426
471
|
{deletable && (
|
|
427
472
|
<DeletePlaceDialog
|
|
428
473
|
path={`${project}/${environment.slug}`}
|
|
@@ -499,7 +544,16 @@ function PersonalConfigs({ project }: { project: string }) {
|
|
|
499
544
|
* folder, without history, or a reference to it. Copying is a read, and
|
|
500
545
|
* logged as one; inheriting reads nothing until the fork is read.
|
|
501
546
|
*/
|
|
502
|
-
function NewEnvironment({
|
|
547
|
+
function NewEnvironment({
|
|
548
|
+
project,
|
|
549
|
+
sources,
|
|
550
|
+
guarded,
|
|
551
|
+
}: {
|
|
552
|
+
project: string;
|
|
553
|
+
sources: string[];
|
|
554
|
+
/** The protected ones: a fork of one is protected too. */
|
|
555
|
+
guarded: string[];
|
|
556
|
+
}) {
|
|
503
557
|
const [open, setOpen] = useState(false);
|
|
504
558
|
const [slug, setSlug] = useState('');
|
|
505
559
|
// '' for empty, 'inherit:prod' for a fork that inherits, 'copy:prod' for a copy, 'ref:prod' for references to prod.
|
|
@@ -599,6 +653,11 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
|
|
|
599
653
|
? `Each of ${from}'s keys, with its current value and folder, without history.`
|
|
600
654
|
: `Each key follows ${from}'s until it gets a value of its own. Whoever can read ${slug === '' ? 'the new environment' : slug} will read ${from}'s values through them, even without access to ${from}.`}
|
|
601
655
|
</span>
|
|
656
|
+
{from !== '' && guarded.includes(from) && (
|
|
657
|
+
<span className="hint">
|
|
658
|
+
<span className="mono">{from}</span> is protected, so the new environment is too, from its first moment.
|
|
659
|
+
</span>
|
|
660
|
+
)}
|
|
602
661
|
{copied.length > 0 && (
|
|
603
662
|
<span className="hint">
|
|
604
663
|
Copied instead, since you read their source only through {from}: <span className="mono">{copied.join(', ')}</span>.
|
package/src/pages/projects.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import { affects } from '../lib/queries';
|
|
|
19
19
|
import { useAction } from '../lib/use-action';
|
|
20
20
|
import { ClosedDoor, PageHeader } from '../components/page';
|
|
21
21
|
import { Tile } from '../components/tile';
|
|
22
|
-
import { AlertTriangle, Folder, Hash, Layers, Plus } from '../components/icons';
|
|
22
|
+
import { AlertTriangle, Folder, Hash, Layers, Lock, Plus } from '../components/icons';
|
|
23
23
|
import {
|
|
24
24
|
ProjectEmptyStateCopy,
|
|
25
25
|
MakesProjectsOnly,
|
|
@@ -239,6 +239,7 @@ function ProjectRow({
|
|
|
239
239
|
params={{ project: project.slug, environment: environment.slug }}
|
|
240
240
|
>
|
|
241
241
|
{environment.slug}
|
|
242
|
+
{environment.protected && <Lock size={11} className="env-link-lock" label="protected" />}
|
|
242
243
|
<span className="count">{environment.details.secretCount}</span>
|
|
243
244
|
</Link>
|
|
244
245
|
) : (
|
|
@@ -248,6 +249,7 @@ function ProjectRow({
|
|
|
248
249
|
title="You can't open this environment"
|
|
249
250
|
>
|
|
250
251
|
{environment.slug}
|
|
252
|
+
{environment.protected && <Lock size={11} className="env-link-lock" label="protected" />}
|
|
251
253
|
</span>
|
|
252
254
|
),
|
|
253
255
|
)}
|
package/src/pages/settings.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import { useAction } from '../lib/use-action';
|
|
|
10
10
|
import { useShell } from '../lib/use-shell';
|
|
11
11
|
import { Card, Fact, PageHeader } from '../components/page';
|
|
12
12
|
import { ScopeField } from '../components/role-field';
|
|
13
|
+
import { RolesSettings } from '../components/role-editor';
|
|
13
14
|
import { ErrorLine, Modal, Spinner, Toggletip } from '../components/ui';
|
|
14
15
|
import { Info, Pencil } from '../components/icons';
|
|
15
16
|
|
|
@@ -71,6 +72,7 @@ export function SettingsPage() {
|
|
|
71
72
|
</dl>
|
|
72
73
|
</Card>
|
|
73
74
|
|
|
75
|
+
<RolesSettings />
|
|
74
76
|
{settings?.ok === true && <ServiceSetup scope={settings.serviceAccounts} />}
|
|
75
77
|
{keys?.ok === true && <Keys keys={keys} />}
|
|
76
78
|
</>
|
package/src/parity.ts
CHANGED
|
@@ -16,8 +16,12 @@ export type ClientCall = {
|
|
|
16
16
|
: `${N}.${keyof CoffreClient[N] & string}`;
|
|
17
17
|
}[keyof CoffreClient & string];
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Where a person does it: the control, in words, its file under `src/`, and
|
|
21
|
+
* the call it makes; with `args`, what the test calls it with, where the
|
|
22
|
+
* stand-ins it uses for every other call would send another route.
|
|
23
|
+
*/
|
|
24
|
+
export type Affordance = { readonly does: string; readonly in: string; readonly call: ClientCall; readonly args?: readonly unknown[] };
|
|
21
25
|
|
|
22
26
|
export type Reach =
|
|
23
27
|
| { readonly ui: readonly Affordance[] }
|
|
@@ -46,7 +50,10 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
46
50
|
ui: [{ does: 'a project › Environments › Add environment, empty, inheriting, a copy or references', in: 'pages/project-environments.tsx', call: 'environments.create' }],
|
|
47
51
|
},
|
|
48
52
|
'PATCH /projects/:project/:environment': {
|
|
49
|
-
ui: [
|
|
53
|
+
ui: [
|
|
54
|
+
{ does: "an environment's card › ⋯ › Rename, Archive…, Restore", in: 'pages/project-environments.tsx', call: 'environments.update' },
|
|
55
|
+
{ does: "an environment's card › ⋯ › Protect…, and for an Owner of the whole instance Unprotect…", in: 'pages/project-environments.tsx', call: 'environments.protect' },
|
|
56
|
+
],
|
|
50
57
|
},
|
|
51
58
|
'DELETE /projects/:project/:environment': {
|
|
52
59
|
ui: [
|
|
@@ -74,6 +81,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
74
81
|
ui: [
|
|
75
82
|
{ does: 'an environment › Add secret, Edit, then Save', in: 'pages/environment.tsx', call: 'secrets.set' },
|
|
76
83
|
{ does: 'an environment › Import .env, after its plan', in: 'pages/environment.tsx', call: 'secrets.set' },
|
|
84
|
+
{ does: 'a secret › ⋯ › Who sees it, stricter: at once, its value kept', in: 'pages/environment.tsx', call: 'secrets.set' },
|
|
77
85
|
],
|
|
78
86
|
},
|
|
79
87
|
'PATCH /secrets/:project/:environment/:key': {
|
|
@@ -133,7 +141,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
133
141
|
'DELETE /members/:member': { ui: [{ does: 'a user or service account › ⋯ › Remove…', in: 'components/directory.tsx', call: 'members.remove' }] },
|
|
134
142
|
'GET /members/:member/tokens': { ui: [{ does: 'a service account › Sign-in › Bearer tokens', in: 'components/service-tokens.tsx', call: 'tokens.list' }] },
|
|
135
143
|
'POST /members/:member/tokens': { ui: [{ does: 'a service account › Sign-in › Issue token', in: 'components/service-tokens.tsx', call: 'tokens.issue' }] },
|
|
136
|
-
'POST /handles': { not: "a handle is
|
|
144
|
+
'POST /handles': { not: "a handle is the placeholder `coffre run` gives the app it starts, which only the credential proxy takes: a page has no app to give one" },
|
|
137
145
|
'DELETE /members/:member/tokens/:id': { ui: [{ does: 'a bearer token › Revoke', in: 'components/service-tokens.tsx', call: 'tokens.revoke' }] },
|
|
138
146
|
'GET /members/:member/bindings': { ui: [{ does: 'a service account › Sign-in › Sign in with OIDC', in: 'components/trusted-workloads.tsx', call: 'bindings.list' }] },
|
|
139
147
|
'POST /members/:member/bindings': {
|
|
@@ -176,7 +184,36 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
176
184
|
{ does: "a user's or service account's page › Activity", in: 'components/actions-log.tsx', call: 'audit.list' },
|
|
177
185
|
],
|
|
178
186
|
},
|
|
179
|
-
'GET /audit/verification': { ui: [{ does: "Audit: the log's seal, verified
|
|
187
|
+
'GET /audit/verification': { ui: [{ does: "Audit: the log's seal, verified with every visit", in: 'pages/audit.tsx', call: 'audit.verify' }] },
|
|
188
|
+
'GET /roles': {
|
|
189
|
+
ui: [
|
|
190
|
+
{ does: 'Settings › Roles and Instance roles; every grant picker, for the roles it offers', in: 'lib/queries.ts', call: 'roles.list' },
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
'PUT /roles/:role': {
|
|
194
|
+
ui: [
|
|
195
|
+
{ does: 'Settings › Roles › Edit… › Save, or New role › Save, once the change is confirmed', in: 'components/role-editor.tsx', call: 'roles.set' },
|
|
196
|
+
{ does: 'the same dialog: what saving would do to everyone it reaches, before it is confirmed', in: 'components/role-editor.tsx', call: 'roles.preview' },
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
'DELETE /roles/:role': {
|
|
200
|
+
ui: [
|
|
201
|
+
{ does: 'Settings › Roles › Edit… › Reset to default, or a custom role’s Delete…', in: 'components/role-editor.tsx', call: 'roles.reset' },
|
|
202
|
+
{ does: 'the same: what it would do, before it is confirmed', in: 'components/role-editor.tsx', call: 'roles.previewReset' },
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
'PUT /instance-roles/:role': {
|
|
206
|
+
ui: [
|
|
207
|
+
{ does: 'Settings › Instance roles › Edit… › Save', in: 'components/role-editor.tsx', call: 'roles.set', args: ['developer', {}, { instance: true }] },
|
|
208
|
+
{ does: 'the same dialog: what saving would do, before it is confirmed', in: 'components/role-editor.tsx', call: 'roles.preview', args: ['developer', {}, { instance: true }] },
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
'DELETE /instance-roles/:role': {
|
|
212
|
+
ui: [
|
|
213
|
+
{ does: 'Settings › Instance roles › Edit… › Reset to default', in: 'components/role-editor.tsx', call: 'roles.reset', args: ['developer', { instance: true }] },
|
|
214
|
+
{ does: 'the same: what it would do, before it is confirmed', in: 'components/role-editor.tsx', call: 'roles.previewReset', args: ['developer', { instance: true }] },
|
|
215
|
+
],
|
|
216
|
+
},
|
|
180
217
|
'GET /settings': { ui: [{ does: 'Settings › Service accounts: where people set them up', in: 'pages/settings.tsx', call: 'settings.get' }] },
|
|
181
218
|
'PUT /settings': { ui: [{ does: 'Settings › Service accounts › Edit', in: 'pages/settings.tsx', call: 'settings.set' }] },
|
|
182
219
|
'GET /audit/keys': { ui: [{ does: 'Settings › Keys: what the keys you keep are checked against', in: 'pages/settings.tsx', call: 'audit.keys' }] },
|
package/src/shared/models.ts
CHANGED
|
@@ -16,6 +16,8 @@ export type Me = ApiMe;
|
|
|
16
16
|
export type SecretKey = ApiSecretKey;
|
|
17
17
|
export type ProjectSummary = ApiProjectSummary;
|
|
18
18
|
export type SecretVersion = ApiSecretVersion;
|
|
19
|
+
/** Who sees a key's value (`lib/sensitivity.ts`). */
|
|
20
|
+
export type Sensitivity = SecretVersion['sensitivity'];
|
|
19
21
|
|
|
20
22
|
/** One member's role at one place in a project, as the project page lists them. */
|
|
21
23
|
export type GrantRow = {
|
|
@@ -35,15 +37,6 @@ export type GrantRow = {
|
|
|
35
37
|
expiresAt: string | null;
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
export type RoleRow = {
|
|
39
|
-
slug: string;
|
|
40
|
-
name: string;
|
|
41
|
-
description: string;
|
|
42
|
-
permissions: Permission[];
|
|
43
|
-
/** False when the role contains a project-only permission. */
|
|
44
|
-
assignableToEnvironment: boolean;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
40
|
export type DirectoryPrincipal = Pick<Member, 'principalType' | 'principalId' | 'instanceRole' | 'scope'> &
|
|
48
41
|
Partial<Pick<Member, 'tampered' | 'managed' | 'declared'>> & {
|
|
49
42
|
/** Where it has access, when the list said; a member just added has none yet. */
|