@crombolo/backoffice-host 0.64.0 → 0.66.0

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.
@@ -0,0 +1,253 @@
1
+ /**
2
+ * The Permissions dialog's rules for a media folder or item (stories 204, 355):
3
+ * the form a saved state comes to, the one-line summary, and the body a form
4
+ * saves as. Browser-free, so the dialog, the command line and the tests share
5
+ * one copy. docs/rendering.md, "Protected media".
6
+ */
7
+
8
+ /**
9
+ * @typedef {{ name: string, read: boolean, write: boolean }} GroupGrant
10
+ * @typedef {{ key: string, read: boolean, write: boolean }} MemberGrant
11
+ * @typedef {{
12
+ * publicRead?: boolean,
13
+ * groups?: GroupGrant[],
14
+ * members?: MemberGrant[],
15
+ * newRead?: string | null,
16
+ * newWrite?: string | null,
17
+ * memberTypes?: string[],
18
+ * memberMaxBytes?: number | null,
19
+ * }} Rule
20
+ * @typedef {{
21
+ * key?: string,
22
+ * name?: string,
23
+ * hasParent?: boolean,
24
+ * hasFile?: boolean,
25
+ * own?: Rule | null,
26
+ * inherited?: (Rule & { from?: { key?: string, name: string } }) | null,
27
+ * item: {
28
+ * readPolicy: string,
29
+ * writePolicy: string,
30
+ * creator?: { key: string, name?: string | null } | null,
31
+ * },
32
+ * protected?: boolean,
33
+ * memberGroups?: string[],
34
+ * usedBy?: string[],
35
+ * }} AccessState
36
+ * @typedef {{
37
+ * inherit: boolean,
38
+ * read: string,
39
+ * write: string,
40
+ * allMembers?: boolean,
41
+ * groups: GroupGrant[],
42
+ * members: MemberGrant[],
43
+ * newRead?: string | null,
44
+ * newWrite?: string | null,
45
+ * memberTypes?: string[],
46
+ * memberMaxBytes?: number | null,
47
+ * }} AccessForm
48
+ */
49
+
50
+ export const PUBLIC_NOTE =
51
+ 'Anyone who has the link can open these files, without signing in, and can pass the link on.'
52
+
53
+ /**
54
+ * One line saying who can see and change a folder or file, as saved.
55
+ * @param {AccessState | undefined} state
56
+ * @returns {string}
57
+ */
58
+ export const summarise = (state) => (state ? describeAccess(formFor(state), state) : '')
59
+
60
+ /**
61
+ * The groups a rule shows: every member group on the site, ticked as the rule
62
+ * says, and any the rule names that no longer exists.
63
+ * @param {Rule | null | undefined} rule
64
+ * @param {string[]} memberGroups
65
+ * @returns {GroupGrant[]}
66
+ */
67
+ export function groupRows(rule, memberGroups) {
68
+ const named = new Map((rule?.groups ?? []).map((g) => [g.name.toLowerCase(), g]))
69
+ const rows = memberGroups.map((name) => {
70
+ const set = named.get(name.toLowerCase())
71
+ return { name, read: set?.read ?? false, write: set?.write ?? false }
72
+ })
73
+ for (const g of rule?.groups ?? [])
74
+ if (!memberGroups.some((name) => name.toLowerCase() === g.name.toLowerCase())) rows.push(g)
75
+ return rows
76
+ }
77
+
78
+ /** Megabytes as the dialog shows a size limit; empty for none. */
79
+ export const megabytesOf = (bytes) =>
80
+ bytes ? String(Math.round((bytes / (1024 * 1024)) * 100) / 100) : ''
81
+
82
+ /** A size limit typed in megabytes, as bytes; null when empty or not a size. */
83
+ export const bytesOf = (megabytes) => {
84
+ const value = Number(String(megabytes ?? '').trim())
85
+ return String(megabytes ?? '').trim() !== '' && Number.isFinite(value) && value > 0
86
+ ? Math.round(value * 1024 * 1024)
87
+ : null
88
+ }
89
+
90
+ /** Read audiences; the default, Enabled, lets anyone with the link see a file. */
91
+ export const READ_MODES = [
92
+ { value: 'public', label: 'Enabled' },
93
+ { value: 'private', label: 'Disabled' },
94
+ { value: 'custom', label: 'Custom' },
95
+ ]
96
+ /** Write audiences: members are never allowed to change files publicly. */
97
+ export const WRITE_MODES = [
98
+ { value: 'private', label: 'No Public Access' },
99
+ { value: 'custom', label: 'Custom' },
100
+ ]
101
+
102
+ /**
103
+ * An existing setting shown without broadening its audience.
104
+ * @param {string} policy
105
+ * @param {'read' | 'write'} action
106
+ * @param {Rule | null | undefined} rule
107
+ */
108
+ export function accessMode(policy, action, rule) {
109
+ if (policy === 'none' || (action === 'write' && ['public', 'members'].includes(policy)))
110
+ return 'private'
111
+ if (policy === 'public') return 'public'
112
+ if (policy !== 'inherit') return 'custom'
113
+ if (action === 'read' && (!rule || rule.publicRead)) return 'public'
114
+ const flag = action === 'read' ? 'read' : 'write'
115
+ return [...(rule?.groups ?? []), ...(rule?.members ?? [])].some((grant) => grant[flag])
116
+ ? 'custom'
117
+ : 'private'
118
+ }
119
+
120
+ /** Whether a folder or item follows the folder above it, with no settings of its own. */
121
+ export const inheritsParent = (state) =>
122
+ Boolean(state.hasParent) &&
123
+ !state.own &&
124
+ state.item.readPolicy === 'inherit' &&
125
+ state.item.writePolicy === 'inherit'
126
+
127
+ /**
128
+ * The dialog's form: the audiences a rule and an item's own policies come to.
129
+ * A file that may only be seen by the member who added it lists that member.
130
+ */
131
+ export function viewOf(rule, item, state) {
132
+ const members = (rule?.members ?? []).map((m) => ({ ...m }))
133
+ const creator = item.creator?.key
134
+ for (const action of ['read', 'write']) {
135
+ if (item[`${action}Policy`] !== 'creator' || !creator) continue
136
+ const existing = members.find((m) => m.key === creator)
137
+ if (existing) existing[action] = true
138
+ else members.push({ key: creator, read: action === 'read', write: action === 'write' })
139
+ }
140
+ const kept = (value) => (value === 'creator' ? value : null)
141
+ return {
142
+ read: accessMode(item.readPolicy, 'read', rule),
143
+ write: accessMode(item.writePolicy, 'write', rule),
144
+ allMembers: item.readPolicy === 'members',
145
+ groups: groupRows(rule, state.memberGroups ?? []),
146
+ members,
147
+ newRead: kept(state.own?.newRead),
148
+ newWrite: kept(state.own?.newWrite),
149
+ memberTypes: [...(rule?.memberTypes ?? [])],
150
+ memberMaxBytes: rule?.memberMaxBytes ?? null,
151
+ }
152
+ }
153
+
154
+ const INHERITED_ITEM = { readPolicy: 'inherit', writePolicy: 'inherit' }
155
+
156
+ /**
157
+ * The form for a folder or item as saved: following the folder above, or its own settings.
158
+ * @param {AccessState} state
159
+ * @returns {AccessForm}
160
+ */
161
+ export function formFor(state) {
162
+ const inherit = inheritsParent(state)
163
+ return {
164
+ inherit,
165
+ ...(inherit
166
+ ? viewOf(state.inherited, INHERITED_ITEM, state)
167
+ : viewOf(state.own ?? state.inherited, state.item, state)),
168
+ }
169
+ }
170
+
171
+ /** The form when "Inherit parent permissions" is ticked again: the folder above's settings. */
172
+ export const inheritedForm = (state) => ({
173
+ inherit: true,
174
+ ...viewOf(state.inherited, INHERITED_ITEM, state),
175
+ })
176
+
177
+ const listed = (names) =>
178
+ names.length <= 1 ? (names[0] ?? '') : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`
179
+
180
+ const chosen = (form, action) => {
181
+ const groups = form.groups.filter((g) => g[action]).map((g) => g.name)
182
+ const count = form.members.filter((m) => m[action]).length
183
+ return listed([...groups, ...(count ? [`${count} chosen member${count === 1 ? '' : 's'}`] : [])])
184
+ }
185
+
186
+ /**
187
+ * Where a form's settings come from and who they let in, in a sentence or two.
188
+ * @param {AccessForm} form
189
+ * @param {AccessState} state
190
+ * @returns {string}
191
+ */
192
+ export function describeAccess(form, state) {
193
+ const source = form.inherit
194
+ ? state.inherited?.from
195
+ ? `Inherited from ${state.inherited.from.name}.`
196
+ : 'Default permissions.'
197
+ : state.hasParent
198
+ ? 'Set for this item.'
199
+ : ''
200
+ const readers = chosen(form, 'read')
201
+ const writers = chosen(form, 'write')
202
+ const read =
203
+ form.read === 'public'
204
+ ? 'Anyone with the link can see this.'
205
+ : form.read === 'private'
206
+ ? 'Only back-office users can see this.'
207
+ : form.allMembers
208
+ ? 'All signed-in members can see this.'
209
+ : readers
210
+ ? `Only ${readers} can see this.`
211
+ : 'Nobody has been chosen to see this yet.'
212
+ const write =
213
+ form.write === 'custom' && writers ? `${writers} can change it.` : 'No members can change it.'
214
+ return [source, read, write].filter(Boolean).join(' ')
215
+ }
216
+
217
+ /**
218
+ * What the dialog sends: no settings of its own when it inherits, else a rule
219
+ * holding both audiences. An all-members read nobody changed is kept as it was.
220
+ * @param {AccessForm} form
221
+ * @param {{ readPolicy: string, writePolicy: string }} [original]
222
+ */
223
+ export function requestFor(form, original = INHERITED_ITEM) {
224
+ if (form.inherit) return { rule: null, item: { ...INHERITED_ITEM } }
225
+ const grants = (list) =>
226
+ list
227
+ .map((g) => ({
228
+ ...g,
229
+ read: form.read === 'custom' && g.read,
230
+ write: form.write === 'custom' && g.write,
231
+ }))
232
+ .filter((g) => g.read || g.write)
233
+ const members = grants(form.members)
234
+ return {
235
+ rule: {
236
+ publicRead: form.read === 'public',
237
+ groups: grants(form.groups),
238
+ ...(members.length ? { members } : {}),
239
+ newRead: form.newRead ?? null,
240
+ newWrite: form.newWrite ?? null,
241
+ memberTypes: form.memberTypes ?? [],
242
+ memberMaxBytes: form.memberMaxBytes ?? null,
243
+ },
244
+ item: {
245
+ readPolicy: form.allMembers && original.readPolicy === 'members' ? 'members' : 'inherit',
246
+ writePolicy: 'inherit',
247
+ },
248
+ }
249
+ }
250
+
251
+ /** Says which site features use a folder, in a sentence. */
252
+ export const usedByText = (bundles) =>
253
+ bundles?.length ? `Used by ${bundles.join(', ')} to store members' files.` : ''
@@ -2,7 +2,8 @@
2
2
  * "Permissions" on media folders and items (story 204): who may read and
3
3
  * change them, and what files added to a folder later get. The
4
4
  * server keeps them at <backoffice>/crombolo/api/media-access/{key}, and
5
- * refuses what the user may not do whatever this shows. docs/rendering.md, "Protected media".
5
+ * refuses what the user may not do whatever this shows. The dialog's rules are
6
+ * in `media-access-rules.js`. docs/rendering.md, "Protected media".
6
7
  */
7
8
 
8
9
  export const MEDIA_ACCESS_MODAL = 'Crombolo.Modal.MediaAccess'
@@ -40,188 +41,6 @@ export const problemFor = (status) =>
40
41
  ? 'This media item could not be found.'
41
42
  : 'The permissions could not be loaded. Try again.'
42
43
 
43
- export const PUBLIC_NOTE =
44
- 'Anyone who has the link can open these files, without signing in, and can pass the link on.'
45
-
46
- /** One line saying who can see and change a folder or file, as saved. */
47
- export const summarise = (state) => (state ? describeAccess(formFor(state), state) : '')
48
-
49
- /**
50
- * The groups a rule shows: every member group on the site, ticked as the rule
51
- * says, and any the rule names that no longer exists.
52
- */
53
- export function groupRows(rule, memberGroups) {
54
- const named = new Map((rule?.groups ?? []).map((g) => [g.name.toLowerCase(), g]))
55
- const rows = memberGroups.map((name) => {
56
- const set = named.get(name.toLowerCase())
57
- return { name, read: set?.read ?? false, write: set?.write ?? false }
58
- })
59
- for (const g of rule?.groups ?? [])
60
- if (!memberGroups.some((name) => name.toLowerCase() === g.name.toLowerCase())) rows.push(g)
61
- return rows
62
- }
63
-
64
- /** Megabytes as the dialog shows a size limit; empty for none. */
65
- export const megabytesOf = (bytes) =>
66
- bytes ? String(Math.round((bytes / (1024 * 1024)) * 100) / 100) : ''
67
-
68
- /** A size limit typed in megabytes, as bytes; null when empty or not a size. */
69
- export const bytesOf = (megabytes) => {
70
- const value = Number(String(megabytes ?? '').trim())
71
- return String(megabytes ?? '').trim() !== '' && Number.isFinite(value) && value > 0
72
- ? Math.round(value * 1024 * 1024)
73
- : null
74
- }
75
-
76
- /** Read audiences; the default, Enabled, lets anyone with the link see a file. */
77
- export const READ_MODES = [
78
- { value: 'public', label: 'Enabled' },
79
- { value: 'private', label: 'Disabled' },
80
- { value: 'custom', label: 'Custom' },
81
- ]
82
- /** Write audiences: members are never allowed to change files publicly. */
83
- export const WRITE_MODES = [
84
- { value: 'private', label: 'No Public Access' },
85
- { value: 'custom', label: 'Custom' },
86
- ]
87
-
88
- /** An existing setting shown without broadening its audience. */
89
- export function accessMode(policy, action, rule) {
90
- if (policy === 'none' || (action === 'write' && ['public', 'members'].includes(policy)))
91
- return 'private'
92
- if (policy === 'public') return 'public'
93
- if (policy !== 'inherit') return 'custom'
94
- if (action === 'read' && (!rule || rule.publicRead)) return 'public'
95
- const flag = action === 'read' ? 'read' : 'write'
96
- return [...(rule?.groups ?? []), ...(rule?.members ?? [])].some((grant) => grant[flag])
97
- ? 'custom'
98
- : 'private'
99
- }
100
-
101
- /** Whether a folder or item follows the folder above it, with no settings of its own. */
102
- export const inheritsParent = (state) =>
103
- Boolean(state.hasParent) &&
104
- !state.own &&
105
- state.item.readPolicy === 'inherit' &&
106
- state.item.writePolicy === 'inherit'
107
-
108
- /**
109
- * The dialog's form: the audiences a rule and an item's own policies come to.
110
- * A file that may only be seen by the member who added it lists that member.
111
- */
112
- export function viewOf(rule, item, state) {
113
- const members = (rule?.members ?? []).map((m) => ({ ...m }))
114
- const creator = item.creator?.key
115
- for (const action of ['read', 'write']) {
116
- if (item[`${action}Policy`] !== 'creator' || !creator) continue
117
- const existing = members.find((m) => m.key === creator)
118
- if (existing) existing[action] = true
119
- else members.push({ key: creator, read: action === 'read', write: action === 'write' })
120
- }
121
- const kept = (value) => (value === 'creator' ? value : null)
122
- return {
123
- read: accessMode(item.readPolicy, 'read', rule),
124
- write: accessMode(item.writePolicy, 'write', rule),
125
- allMembers: item.readPolicy === 'members',
126
- groups: groupRows(rule, state.memberGroups ?? []),
127
- members,
128
- newRead: kept(state.own?.newRead),
129
- newWrite: kept(state.own?.newWrite),
130
- memberTypes: [...(rule?.memberTypes ?? [])],
131
- memberMaxBytes: rule?.memberMaxBytes ?? null,
132
- }
133
- }
134
-
135
- const INHERITED_ITEM = { readPolicy: 'inherit', writePolicy: 'inherit' }
136
-
137
- /** The form for a folder or item as saved: following the folder above, or its own settings. */
138
- export function formFor(state) {
139
- const inherit = inheritsParent(state)
140
- return {
141
- inherit,
142
- ...(inherit
143
- ? viewOf(state.inherited, INHERITED_ITEM, state)
144
- : viewOf(state.own ?? state.inherited, state.item, state)),
145
- }
146
- }
147
-
148
- /** The form when "Inherit parent permissions" is ticked again: the folder above's settings. */
149
- export const inheritedForm = (state) => ({
150
- inherit: true,
151
- ...viewOf(state.inherited, INHERITED_ITEM, state),
152
- })
153
-
154
- const listed = (names) =>
155
- names.length <= 1 ? (names[0] ?? '') : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`
156
-
157
- const chosen = (form, action) => {
158
- const groups = form.groups.filter((g) => g[action]).map((g) => g.name)
159
- const count = form.members.filter((m) => m[action]).length
160
- return listed([...groups, ...(count ? [`${count} chosen member${count === 1 ? '' : 's'}`] : [])])
161
- }
162
-
163
- /** Where a form's settings come from and who they let in, in a sentence or two. */
164
- export function describeAccess(form, state) {
165
- const source = form.inherit
166
- ? state.inherited?.from
167
- ? `Inherited from ${state.inherited.from.name}.`
168
- : 'Default permissions.'
169
- : state.hasParent
170
- ? 'Set for this item.'
171
- : ''
172
- const readers = chosen(form, 'read')
173
- const writers = chosen(form, 'write')
174
- const read =
175
- form.read === 'public'
176
- ? 'Anyone with the link can see this.'
177
- : form.read === 'private'
178
- ? 'Only back-office users can see this.'
179
- : form.allMembers
180
- ? 'All signed-in members can see this.'
181
- : readers
182
- ? `Only ${readers} can see this.`
183
- : 'Nobody has been chosen to see this yet.'
184
- const write =
185
- form.write === 'custom' && writers ? `${writers} can change it.` : 'No members can change it.'
186
- return [source, read, write].filter(Boolean).join(' ')
187
- }
188
-
189
- /**
190
- * What the dialog sends: no settings of its own when it inherits, else a rule
191
- * holding both audiences. An all-members read nobody changed is kept as it was.
192
- */
193
- export function requestFor(form, original = INHERITED_ITEM) {
194
- if (form.inherit) return { rule: null, item: { ...INHERITED_ITEM } }
195
- const grants = (list) =>
196
- list
197
- .map((g) => ({
198
- ...g,
199
- read: form.read === 'custom' && g.read,
200
- write: form.write === 'custom' && g.write,
201
- }))
202
- .filter((g) => g.read || g.write)
203
- const members = grants(form.members)
204
- return {
205
- rule: {
206
- publicRead: form.read === 'public',
207
- groups: grants(form.groups),
208
- ...(members.length ? { members } : {}),
209
- newRead: form.newRead ?? null,
210
- newWrite: form.newWrite ?? null,
211
- memberTypes: form.memberTypes ?? [],
212
- memberMaxBytes: form.memberMaxBytes ?? null,
213
- },
214
- item: {
215
- readPolicy: form.allMembers && original.readPolicy === 'members' ? 'members' : 'inherit',
216
- writePolicy: 'inherit',
217
- },
218
- }
219
- }
220
-
221
- /** Says which site features use a folder, in a sentence. */
222
- export const usedByText = (bundles) =>
223
- bundles?.length ? `Used by ${bundles.join(', ')} to store members' files.` : ''
224
-
225
44
  const MEDIA_WRITE = /\/management\/api\/v1\/media\/([0-9a-f-]{36})(\/move|\/move-to-recycle-bin)?$/i
226
45
 
227
46
  /**
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo Search & sharing",
4
4
  "id": "Crombolo.Seo",
5
- "version": "0.64.0",
5
+ "version": "0.66.0",
6
6
  "allowPublicAccess": false,
7
7
  "extensions": [
8
8
  {
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo Sign-in Dialog",
4
4
  "id": "Crombolo.SignInDialog",
5
- "version": "0.64.0",
5
+ "version": "0.66.0",
6
6
  "allowPublicAccess": true,
7
7
  "extensions": [
8
8
  {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The words of Settings → Trusted signers. Pure, so the unit tests read it
3
+ * outside a browser.
4
+ */
5
+
6
+ /**
7
+ * What removing a signer switched off (story 335): the extensions it vouched for,
8
+ * which act as you or run unrestricted, and stop now rather than at the next start.
9
+ *
10
+ * @param {string[] | undefined} names
11
+ * @returns {string}
12
+ */
13
+ export function switchedOffWords(names) {
14
+ if (!names || names.length === 0) return ''
15
+ const list =
16
+ names.length === 1 ? names[0] : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`
17
+ return `${list} ${names.length === 1 ? 'was' : 'were'} switched off: nothing this site trusts vouches for ${names.length === 1 ? 'it' : 'them'} now. Trust the signer again, or grant ${names.length === 1 ? 'it' : 'them'} again, to turn ${names.length === 1 ? 'it' : 'them'} back on.`
18
+ }
@@ -9,6 +9,7 @@ import { UMB_CURRENT_USER_CONTEXT } from '@umbraco-cms/backoffice/current-user'
9
9
  import { css, html, nothing, repeat } from '@umbraco-cms/backoffice/external/lit'
10
10
  import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
11
11
  import { umbConfirmModal } from '@umbraco-cms/backoffice/modal'
12
+ import { switchedOffWords } from './trusted-signers-words.js'
12
13
 
13
14
  const base = () => {
14
15
  const href = document.querySelector('base')?.getAttribute('href') ?? '/umbraco/'
@@ -48,6 +49,7 @@ export default class CromboloTrustedSignersElement extends UmbLitElement {
48
49
  _draft: { state: true },
49
50
  _renaming: { state: true },
50
51
  _problem: { state: true },
52
+ _notice: { state: true },
51
53
  _busy: { state: true },
52
54
  _copied: { state: true },
53
55
  _mine: { state: true },
@@ -154,10 +156,14 @@ export default class CromboloTrustedSignersElement extends UmbLitElement {
154
156
  color: 'danger',
155
157
  headline: `Stop trusting ${item.name}?`,
156
158
  content:
157
- 'Site bundles it signed are refused from now on, including ones already made. You can add it again later.',
159
+ 'Site bundles it signed are refused from now on, including ones already made. An extension it vouched for that acts as you or runs unrestricted is switched off now. You can add it again later.',
158
160
  confirmLabel: 'Remove',
159
161
  })
160
- await this.#run(() => call(`/${item.id}`, 'DELETE'))
162
+ this._notice = ''
163
+ await this.#run(async () => {
164
+ const result = await call(`/${item.id}`, 'DELETE')
165
+ this._notice = switchedOffWords(result.switchedOff)
166
+ })
161
167
  }
162
168
 
163
169
  async #copy(line) {
@@ -296,6 +302,7 @@ export default class CromboloTrustedSignersElement extends UmbLitElement {
296
302
  required; elsewhere an unsigned one is applied, with a warning.
297
303
  </p>
298
304
  ${this._problem ? html`<p class="problem" role="alert">${this._problem}</p>` : nothing}
305
+ ${this._notice ? html`<p class="notice" role="status">${this._notice}</p>` : nothing}
299
306
  <ul class="signers">
300
307
  ${repeat(
301
308
  this._items,
@@ -361,6 +368,9 @@ export default class CromboloTrustedSignersElement extends UmbLitElement {
361
368
  .problem {
362
369
  color: var(--uui-color-danger);
363
370
  }
371
+ .notice {
372
+ color: var(--uui-color-warning-standalone);
373
+ }
364
374
  .steps {
365
375
  margin: 0;
366
376
  padding-left: var(--uui-size-space-6);
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo",
4
4
  "id": "Crombolo.Core",
5
- "version": "0.64.0",
5
+ "version": "0.66.0",
6
6
  "allowPublicAccess": false,
7
7
  "extensions": [
8
8
  {
@@ -98,6 +98,17 @@
98
98
  "description": "Install bundles, the code a bundle carries and the templates it adds or changes, and push a whole site: all of these run on the server. Administrators only have this when a group gives it to them: give it to a group of its own rather than Administrators"
99
99
  }
100
100
  },
101
+ {
102
+ "type": "entityUserPermission",
103
+ "alias": "Crombolo.UserPermission.CliTokens.Create",
104
+ "name": "Crombolo Command-line Tokens Permission",
105
+ "forEntityTypes": ["crombolo-remote"],
106
+ "meta": {
107
+ "verbs": ["Crombolo.CliTokens.Create"],
108
+ "label": "Command-line tokens",
109
+ "description": "Create tokens that let scripts run commands as you"
110
+ }
111
+ },
101
112
  {
102
113
  "type": "entityUserPermission",
103
114
  "alias": "Crombolo.UserPermission.Media.Read",
@@ -138,6 +149,12 @@
138
149
  "name": "Crombolo Preview Member",
139
150
  "js": "/crombolo-plugin/preview-member.js"
140
151
  },
152
+ {
153
+ "type": "backofficeEntryPoint",
154
+ "alias": "Crombolo.EntryPoint.ViewAs",
155
+ "name": "Crombolo View As A Group",
156
+ "js": "/crombolo-plugin/view-as.js"
157
+ },
141
158
  {
142
159
  "type": "backofficeEntryPoint",
143
160
  "alias": "Crombolo.EntryPoint.MediaAccess",
@@ -161,6 +178,17 @@
161
178
  "pathname": "devices"
162
179
  }
163
180
  },
181
+ {
182
+ "type": "userProfileApp",
183
+ "alias": "Crombolo.UserProfileApp.CliTokens",
184
+ "name": "Crombolo Command-line Tokens",
185
+ "element": "/crombolo-plugin/cli-tokens.js",
186
+ "weight": 90,
187
+ "meta": {
188
+ "label": "Command-line tokens",
189
+ "pathname": "tokens"
190
+ }
191
+ },
164
192
  {
165
193
  "type": "mfaLoginProvider",
166
194
  "alias": "Crombolo.MfaLoginProvider.Authenticator",
@@ -436,6 +464,27 @@
436
464
  }
437
465
  ]
438
466
  },
467
+ {
468
+ "type": "workspaceView",
469
+ "alias": "Crombolo.WorkspaceView.User.CliTokens",
470
+ "name": "Crombolo User Command-line Tokens",
471
+ "element": "/crombolo-plugin/cli-tokens-user.js",
472
+ "weight": 50,
473
+ "meta": {
474
+ "label": "Tokens",
475
+ "pathname": "tokens",
476
+ "icon": "icon-key"
477
+ },
478
+ "conditions": [
479
+ {
480
+ "alias": "Umb.Condition.WorkspaceAlias",
481
+ "match": "Umb.Workspace.User"
482
+ },
483
+ {
484
+ "alias": "Umb.Condition.CurrentUser.IsAdmin"
485
+ }
486
+ ]
487
+ },
439
488
  {
440
489
  "type": "dashboard",
441
490
  "alias": "Crombolo.Dashboard.ContentSettings",
@@ -0,0 +1,14 @@
1
+ /** "View as a group…" in the user menu: opens the panel to choose the groups (story 314). */
2
+ import { UmbActionBase } from '@umbraco-cms/backoffice/action'
3
+ import { umbOpenModal } from '@umbraco-cms/backoffice/modal'
4
+ import { VIEW_AS_MODAL } from './view-as.js'
5
+
6
+ export class CromboloViewAsAction extends UmbActionBase {
7
+ async execute() {
8
+ await umbOpenModal(this, VIEW_AS_MODAL, { modal: { type: 'sidebar', size: 'small' } }).catch(
9
+ () => undefined,
10
+ )
11
+ }
12
+ }
13
+
14
+ export { CromboloViewAsAction as api }