@backstage/plugin-catalog-backend 1.3.1-next.0 → 1.3.1-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 1.3.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e3d3018531: Fix issue for conditional decisions based on properties stored as arrays, like tags.
8
+
9
+ Before this change, having a permission policy returning conditional decisions based on metadata like tags, such like `createCatalogConditionalDecision(permission, catalogConditions.hasMetadata('tags', 'java'),)`, was producing wrong results. The issue occurred when authorizing entities already loaded from the database, for example when authorizing `catalogEntityDeletePermission`.
10
+
11
+ - Updated dependencies
12
+ - @backstage/plugin-catalog-common@1.0.5-next.0
13
+ - @backstage/backend-common@0.15.0-next.1
14
+ - @backstage/integration@1.3.0-next.1
15
+
3
16
  ## 1.3.1-next.0
4
17
 
5
18
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "1.3.1-next.0",
3
+ "version": "1.3.1-next.1",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
package/dist/index.cjs.js CHANGED
@@ -886,6 +886,12 @@ const createPropertyRule = (propertyType) => createCatalogPermissionRule({
886
886
  resourceType: pluginCatalogCommon.RESOURCE_TYPE_CATALOG_ENTITY,
887
887
  apply: (resource, key, value) => {
888
888
  const foundValue = lodash.get(resource[propertyType], key);
889
+ if (Array.isArray(foundValue)) {
890
+ if (value !== void 0) {
891
+ return foundValue.includes(value);
892
+ }
893
+ return foundValue.length > 0;
894
+ }
889
895
  if (value !== void 0) {
890
896
  return value === foundValue;
891
897
  }
@@ -4026,6 +4032,7 @@ class CatalogBuilder {
4026
4032
  (resourceRef) => entitiesByRef[catalogModel.stringifyEntityRef(catalogModel.parseEntityRef(resourceRef))]
4027
4033
  );
4028
4034
  },
4035
+ permissions: pluginCatalogCommon.catalogPermissions,
4029
4036
  rules: this.permissionRules
4030
4037
  });
4031
4038
  const stitcher = new Stitcher(dbClient, logger);