@adobe/helix-config 5.4.7 → 5.4.9
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/CHANGELOG.md +14 -0
- package/package.json +8 -8
- package/src/config-view.js +45 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [5.4.9](https://github.com/adobe/helix-config/compare/v5.4.8...v5.4.9) (2025-07-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* filter empty group entries ([#298](https://github.com/adobe/helix-config/issues/298)) ([1510199](https://github.com/adobe/helix-config/commit/1510199d2a6054ad815c25f743cb16e75fc79510))
|
|
7
|
+
|
|
8
|
+
## [5.4.8](https://github.com/adobe/helix-config/compare/v5.4.7...v5.4.8) (2025-06-30)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* load user group sheets dynamically ([#295](https://github.com/adobe/helix-config/issues/295)) ([3327e02](https://github.com/adobe/helix-config/commit/3327e0249d7329146982b315ed1c79cdcc102994)), closes [#292](https://github.com/adobe/helix-config/issues/292)
|
|
14
|
+
|
|
1
15
|
## [5.4.7](https://github.com/adobe/helix-config/compare/v5.4.6...v5.4.7) (2025-06-15)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-config",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.9",
|
|
4
4
|
"description": "Helix Config",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
"reporter-options": "configFile=.mocha-multi.json"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@adobe/eslint-config-helix": "3.0.
|
|
39
|
-
"@eslint/config-helpers": "0.
|
|
38
|
+
"@adobe/eslint-config-helix": "3.0.6",
|
|
39
|
+
"@eslint/config-helpers": "0.3.0",
|
|
40
40
|
"@semantic-release/changelog": "6.0.3",
|
|
41
41
|
"@semantic-release/git": "10.0.1",
|
|
42
|
-
"@semantic-release/npm": "12.0.
|
|
42
|
+
"@semantic-release/npm": "12.0.2",
|
|
43
43
|
"c8": "10.1.3",
|
|
44
44
|
"eslint": "9.4.0",
|
|
45
45
|
"husky": "9.1.7",
|
|
46
46
|
"junit-report-builder": "5.1.1",
|
|
47
|
-
"lint-staged": "16.1.
|
|
48
|
-
"mocha": "11.
|
|
47
|
+
"lint-staged": "16.1.2",
|
|
48
|
+
"mocha": "11.7.1",
|
|
49
49
|
"mocha-multi-reporters": "1.5.1",
|
|
50
|
-
"mocha-suppress-logs": "0.
|
|
50
|
+
"mocha-suppress-logs": "0.6.0",
|
|
51
51
|
"nock": "13.5.6",
|
|
52
|
-
"semantic-release": "24.2.
|
|
52
|
+
"semantic-release": "24.2.6"
|
|
53
53
|
},
|
|
54
54
|
"lint-staged": {
|
|
55
55
|
"*.js": "eslint",
|
package/src/config-view.js
CHANGED
|
@@ -394,13 +394,37 @@ function resolveGroup(groups, name) {
|
|
|
394
394
|
return users.map((user) => user.email);
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
+
async function loadGroup(ctx, siteConfig, path) {
|
|
398
|
+
const { contentBusId } = siteConfig.data.content;
|
|
399
|
+
const key = `${contentBusId}/preview/${path}`;
|
|
400
|
+
const res = await ctx.loader.getObject(HELIX_CONTENT_BUS, key);
|
|
401
|
+
if (!res.body) {
|
|
402
|
+
ctx.log.info('referenced user sheet does not exist: %s', key);
|
|
403
|
+
return [];
|
|
404
|
+
}
|
|
405
|
+
siteConfig.updateLastModified(res.headers);
|
|
406
|
+
|
|
407
|
+
// return users
|
|
408
|
+
const users = JSON.parse(res.body);
|
|
409
|
+
if (!users.default?.data?.length) {
|
|
410
|
+
ctx.log.info('referenced user sheet is empty: %s', key);
|
|
411
|
+
return [];
|
|
412
|
+
}
|
|
413
|
+
ctx.log.info('loaded user sheet from %s. %d users', key, users.default.data.length);
|
|
414
|
+
return users.default.data
|
|
415
|
+
.map((row) => ModifiersConfig.toLowerKeys(row).user)
|
|
416
|
+
.filter((entry) => !!entry);
|
|
417
|
+
}
|
|
418
|
+
|
|
397
419
|
/**
|
|
398
420
|
* Compute the access.admin.role arrays for the admin config. Resolves site and org groups.
|
|
421
|
+
* @param ctx
|
|
422
|
+
* @param siteConfig
|
|
399
423
|
* @param admin
|
|
400
424
|
* @param orgConfig
|
|
401
425
|
* @param configGroups
|
|
402
426
|
*/
|
|
403
|
-
function computeSiteAdminRoles(admin, orgConfig, configGroups = {}) {
|
|
427
|
+
async function computeSiteAdminRoles(ctx, siteConfig, admin, orgConfig, configGroups = {}) {
|
|
404
428
|
const {
|
|
405
429
|
users: orgUsers = [],
|
|
406
430
|
groups: orgGroups = {},
|
|
@@ -412,15 +436,20 @@ function computeSiteAdminRoles(admin, orgConfig, configGroups = {}) {
|
|
|
412
436
|
if (entry.indexOf('@') > 0) {
|
|
413
437
|
users.add(entry);
|
|
414
438
|
} else if (entry.startsWith('groups/')) {
|
|
415
|
-
// keep entry in list so that admin can auto-migrate updates to the groups json
|
|
416
|
-
// TODO: remove after v4 EOL
|
|
417
|
-
users.add(entry);
|
|
418
439
|
const reference = entry.endsWith('.json')
|
|
419
440
|
? entry.substring(7, entry.length - 5)
|
|
420
441
|
: entry.substring(7);
|
|
421
442
|
for (const email of resolveGroup(configGroups, reference)) {
|
|
422
443
|
users.add(email);
|
|
423
444
|
}
|
|
445
|
+
// load users dynamically as well
|
|
446
|
+
// eslint-disable-next-line no-await-in-loop
|
|
447
|
+
const group = await loadGroup(ctx, siteConfig, `.helix/${reference}.json`);
|
|
448
|
+
for (const email of group) {
|
|
449
|
+
users.add(email);
|
|
450
|
+
}
|
|
451
|
+
// add entry in list so that admin can purge the config when modified
|
|
452
|
+
users.add(`/.helix/${reference}.json`);
|
|
424
453
|
} else if (entry.startsWith('/groups/')) {
|
|
425
454
|
const reference = entry.endsWith('.json')
|
|
426
455
|
? entry.substring(8, entry.length - 5)
|
|
@@ -428,6 +457,17 @@ function computeSiteAdminRoles(admin, orgConfig, configGroups = {}) {
|
|
|
428
457
|
for (const email of resolveGroup(orgGroups, reference)) {
|
|
429
458
|
users.add(email);
|
|
430
459
|
}
|
|
460
|
+
} else if (entry.startsWith('/')) {
|
|
461
|
+
const reference = entry.endsWith('.json')
|
|
462
|
+
? entry.substring(1)
|
|
463
|
+
: `${entry.substring(1)}.json`;
|
|
464
|
+
// eslint-disable-next-line no-await-in-loop
|
|
465
|
+
const group = await loadGroup(ctx, siteConfig, reference);
|
|
466
|
+
for (const email of group) {
|
|
467
|
+
users.add(email);
|
|
468
|
+
}
|
|
469
|
+
// add entry in list so that admin can purge the config when modified
|
|
470
|
+
users.add(`/${reference}`);
|
|
431
471
|
}
|
|
432
472
|
}
|
|
433
473
|
roles[roleName] = Array.from(users);
|
|
@@ -507,7 +547,7 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
507
547
|
};
|
|
508
548
|
if (opts.scope === SCOPE_ADMIN || opts.scope === SCOPE_RAW) {
|
|
509
549
|
// eslint-disable-next-line max-len
|
|
510
|
-
config.access.admin = computeSiteAdminRoles(admin, orgConfig, config.groups);
|
|
550
|
+
config.access.admin = await computeSiteAdminRoles(ctx, siteConfig, admin, orgConfig, config.groups);
|
|
511
551
|
}
|
|
512
552
|
prune(config.access);
|
|
513
553
|
if (!Object.keys(config.access).length) {
|