@adobe/helix-config 4.4.0 → 4.5.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [4.5.0](https://github.com/adobe/helix-config/compare/v4.4.0...v4.5.0) (2024-09-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * include org apiKeyId to admin and raw scope ([#181](https://github.com/adobe/helix-config/issues/181)) ([223c5bf](https://github.com/adobe/helix-config/commit/223c5bf70b2c8c00c7171b009b294785be7a42c9))
7
+
1
8
  # [4.4.0](https://github.com/adobe/helix-config/compare/v4.3.3...v4.4.0) (2024-09-05)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -343,11 +343,14 @@ function resolveGroup(groups, name) {
343
343
  /**
344
344
  * Compute the access.admin.role arrays for the admin config. Resolves site and org groups.
345
345
  * @param admin
346
+ * @param orgConfig
346
347
  * @param configGroups
347
- * @param orgGroups
348
- * @param orgUsers
349
348
  */
350
- function computeSiteAdminRoles(admin, configGroups = {}, orgGroups = {}, orgUsers = []) {
349
+ function computeSiteAdminRoles(admin, orgConfig, configGroups = {}) {
350
+ const {
351
+ users: orgUsers = [],
352
+ groups: orgGroups = {},
353
+ } = orgConfig ?? {};
351
354
  const roles = {};
352
355
  for (const [roleName, role] of Object.entries(admin.role ?? {})) {
353
356
  const users = new Set();
@@ -385,6 +388,11 @@ function computeSiteAdminRoles(admin, configGroups = {}, orgGroups = {}, orgUser
385
388
  ...admin,
386
389
  role: roles,
387
390
  };
391
+
392
+ const apiKeyId = new Set([...admin.apiKeyId ?? [], ...orgConfig?.access?.admin?.apiKeyId ?? []]);
393
+ if (apiKeyId.size) {
394
+ ret.apiKeyId = Array.from(apiKeyId);
395
+ }
388
396
  // if there are only roles from the org, ensure that they don't enforce auth
389
397
  if (hasOrgUsers && !hasRoles && (!admin.requireAuth || admin.requireAuth === 'auto')) {
390
398
  ret.requireAuth = false;
@@ -436,7 +444,7 @@ export async function getConfigResponse(ctx, opts) {
436
444
  };
437
445
  if (opts.scope === SCOPE_ADMIN || opts.scope === SCOPE_RAW) {
438
446
  // eslint-disable-next-line max-len
439
- config.access.admin = computeSiteAdminRoles(admin, config.groups, orgConfig?.groups, orgConfig?.users);
447
+ config.access.admin = computeSiteAdminRoles(admin, orgConfig, config.groups);
440
448
  } else {
441
449
  // for pipeline and delivery, also load the site tokens
442
450
  const tst = await loadTransientSiteToken(ctx, rso.org, rso.site);