@backstage/plugin-catalog-backend 0.21.0 → 0.21.2

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,5 +1,44 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 0.21.2
4
+
5
+ ### Patch Changes
6
+
7
+ - fac5f112b4: chore(deps): bump `prom-client` from 13.2.0 to 14.0.1
8
+ - 5bbffa60be: Pass authorization token to location service inside location api routes
9
+ - Updated dependencies
10
+ - @backstage/plugin-catalog-common@0.1.2
11
+ - @backstage/backend-common@0.10.6
12
+ - @backstage/plugin-permission-node@0.4.2
13
+
14
+ ## 0.21.2-next.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+ - @backstage/plugin-catalog-common@0.1.2-next.0
20
+ - @backstage/backend-common@0.10.6-next.0
21
+ - @backstage/plugin-permission-node@0.4.2-next.1
22
+
23
+ ## 0.21.2-next.0
24
+
25
+ ### Patch Changes
26
+
27
+ - fac5f112b4: chore(deps): bump `prom-client` from 13.2.0 to 14.0.1
28
+ - 5bbffa60be: Pass authorization token to location service inside location api routes
29
+ - Updated dependencies
30
+ - @backstage/plugin-permission-node@0.4.2-next.0
31
+
32
+ ## 0.21.1
33
+
34
+ ### Patch Changes
35
+
36
+ - 4f5bde47e9: Add support for permissions to the DefaultCatalogCollator.
37
+ - Updated dependencies
38
+ - @backstage/search-common@0.2.2
39
+ - @backstage/backend-common@0.10.5
40
+ - @backstage/plugin-permission-node@0.4.1
41
+
3
42
  ## 0.21.0
4
43
 
5
44
  ### Minor Changes
package/dist/index.cjs.js CHANGED
@@ -21,6 +21,7 @@ var graphql = require('@octokit/graphql');
21
21
  var backendCommon = require('@backstage/backend-common');
22
22
  var yaml = require('yaml');
23
23
  var catalogClient = require('@backstage/catalog-client');
24
+ var pluginCatalogCommon = require('@backstage/plugin-catalog-common');
24
25
  var crypto = require('crypto');
25
26
  var express = require('express');
26
27
  var Router = require('express-promise-router');
@@ -29,7 +30,6 @@ var uuid = require('uuid');
29
30
  var luxon = require('luxon');
30
31
  var promClient = require('prom-client');
31
32
  var stableStringify = require('fast-json-stable-stringify');
32
- var pluginCatalogCommon = require('@backstage/plugin-catalog-common');
33
33
  var pluginPermissionCommon = require('@backstage/plugin-permission-common');
34
34
  var pluginPermissionNode = require('@backstage/plugin-permission-node');
35
35
 
@@ -1930,6 +1930,7 @@ function withLocations(baseUrl, org, entity) {
1930
1930
  class DefaultCatalogCollator {
1931
1931
  constructor(options) {
1932
1932
  this.type = "software-catalog";
1933
+ this.visibilityPermission = pluginCatalogCommon.catalogEntityReadPermission;
1933
1934
  const { discovery, locationTemplate, filter, catalogClient: catalogClient$1, tokenManager } = options;
1934
1935
  this.discovery = discovery;
1935
1936
  this.locationTemplate = locationTemplate || "/catalog/:namespace/:kind/:name";
@@ -1984,7 +1985,10 @@ class DefaultCatalogCollator {
1984
1985
  namespace: entity.metadata.namespace || "default",
1985
1986
  kind: entity.kind,
1986
1987
  lifecycle: ((_d = entity.spec) == null ? void 0 : _d.lifecycle) || "",
1987
- owner: ((_e = entity.spec) == null ? void 0 : _e.owner) || ""
1988
+ owner: ((_e = entity.spec) == null ? void 0 : _e.owner) || "",
1989
+ authorization: {
1990
+ resourceRef: catalogModel.stringifyEntityRef(entity)
1991
+ }
1988
1992
  };
1989
1993
  });
1990
1994
  }
@@ -2662,19 +2666,27 @@ async function createRouter(options) {
2662
2666
  if (!dryRun) {
2663
2667
  disallowReadonlyMode(readonlyEnabled);
2664
2668
  }
2665
- const output = await locationService.createLocation(input, dryRun);
2669
+ const output = await locationService.createLocation(input, dryRun, {
2670
+ authorizationToken: getBearerToken(req.header("authorization"))
2671
+ });
2666
2672
  res.status(201).json(output);
2667
- }).get("/locations", async (_req, res) => {
2668
- const locations = await locationService.listLocations();
2673
+ }).get("/locations", async (req, res) => {
2674
+ const locations = await locationService.listLocations({
2675
+ authorizationToken: getBearerToken(req.header("authorization"))
2676
+ });
2669
2677
  res.status(200).json(locations.map((l) => ({ data: l })));
2670
2678
  }).get("/locations/:id", async (req, res) => {
2671
2679
  const { id } = req.params;
2672
- const output = await locationService.getLocation(id);
2680
+ const output = await locationService.getLocation(id, {
2681
+ authorizationToken: getBearerToken(req.header("authorization"))
2682
+ });
2673
2683
  res.status(200).json(output);
2674
2684
  }).delete("/locations/:id", async (req, res) => {
2675
2685
  disallowReadonlyMode(readonlyEnabled);
2676
2686
  const { id } = req.params;
2677
- await locationService.deleteLocation(id);
2687
+ await locationService.deleteLocation(id, {
2688
+ authorizationToken: getBearerToken(req.header("authorization"))
2689
+ });
2678
2690
  res.status(204).end();
2679
2691
  });
2680
2692
  }