@backstage-community/plugin-rbac-backend 7.11.0 → 7.12.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,5 +1,17 @@
1
1
  # @backstage-community/plugin-rbac-backend
2
2
 
3
+ ## 7.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8993474: Backstage version bump to v1.49.2
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [8993474]
12
+ - @backstage-community/plugin-rbac-common@1.26.0
13
+ - @backstage-community/plugin-rbac-node@1.20.0
14
+
3
15
  ## 7.11.0
4
16
 
5
17
  ### Minor Changes
@@ -1,20 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  var pluginPermissionNode = require('@backstage/plugin-permission-node');
4
- var zod = require('zod');
5
- var zodToJsonSchema = require('zod-to-json-schema');
4
+ var v3 = require('zod/v3');
5
+ var v4 = require('zod/v4');
6
6
  var resource = require('./resource.cjs.js');
7
7
 
8
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
9
-
10
- var zodToJsonSchema__default = /*#__PURE__*/_interopDefaultCompat(zodToJsonSchema);
11
-
12
8
  const isOwner = pluginPermissionNode.createPermissionRule({
13
9
  name: "IS_OWNER",
14
10
  description: "Should allow access to RBAC roles and Permissions through ownership",
15
11
  resourceRef: resource.permissionMetadataResourceRef,
16
- paramsSchema: zod.z.object({
17
- owners: zod.z.string().array().describe("List of entity refs to match against")
12
+ paramsSchema: v3.z.object({
13
+ owners: v3.z.string().array().describe("List of entity refs to match against")
18
14
  }),
19
15
  apply: (roleMeta, { owners }) => {
20
16
  if (roleMeta.isDefault) {
@@ -34,7 +30,9 @@ const rbacRules = {
34
30
  name: isOwner.name,
35
31
  description: isOwner.description,
36
32
  resourceType: isOwner.resourceType,
37
- paramsSchema: zodToJsonSchema__default.default(isOwner.paramsSchema ?? zod.z.object({}))
33
+ paramsSchema: v4.z.object({
34
+ owners: v4.z.string().array().describe("List of entity refs to match against")
35
+ }).toJSONSchema()
38
36
  };
39
37
  const rules = { isOwner };
40
38
 
@@ -1 +1 @@
1
- {"version":3,"file":"rules.cjs.js","sources":["../../src/permissions/rules.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createPermissionRule } from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\nimport zodToJsonSchema from 'zod-to-json-schema';\nimport { permissionMetadataResourceRef } from './resource';\nimport { RoleMetadataDao } from '../database/role-metadata';\n\n/**\n * The RBACFilter is a simple filter without any conditional criteria.\n *\n */\nexport type RBACFilter = {\n key: string;\n values: any[];\n};\n\n/**\n * The RBACFilters type is a recursive type that can be used to create complex filter structures.\n * It can be used to create filters that are a combination of other filters, or a negation of a filter.\n *\n */\nexport type RBACFilters =\n | { anyOf: RBACFilters[] }\n | { allOf: RBACFilters[] }\n | { not: RBACFilters }\n | RBACFilter;\n\nconst isOwner = createPermissionRule({\n name: 'IS_OWNER',\n description:\n 'Should allow access to RBAC roles and Permissions through ownership',\n resourceRef: permissionMetadataResourceRef,\n paramsSchema: z.object({\n owners: z.string().array().describe('List of entity refs to match against'),\n }),\n apply: (roleMeta: RoleMetadataDao, { owners }) => {\n if (roleMeta.isDefault) {\n return true;\n }\n if (!roleMeta.owner) {\n return false;\n }\n return owners.includes(roleMeta.owner);\n },\n toQuery: ({ owners }) => ({\n key: 'owners',\n values: owners,\n }),\n});\n\nexport const rbacRules = {\n name: isOwner.name,\n description: isOwner.description,\n resourceType: isOwner.resourceType,\n paramsSchema: zodToJsonSchema(isOwner.paramsSchema ?? z.object({})),\n};\n\nexport const rules = { isOwner };\n"],"names":["createPermissionRule","permissionMetadataResourceRef","z","zodToJsonSchema"],"mappings":";;;;;;;;;;;AAyCA,MAAM,UAAUA,yCAAqB,CAAA;AAAA,EACnC,IAAM,EAAA,UAAA;AAAA,EACN,WACE,EAAA,qEAAA;AAAA,EACF,WAAa,EAAAC,sCAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,QAAQA,KAAE,CAAA,MAAA,GAAS,KAAM,EAAA,CAAE,SAAS,sCAAsC;AAAA,GAC3E,CAAA;AAAA,EACD,KAAO,EAAA,CAAC,QAA2B,EAAA,EAAE,QAAa,KAAA;AAChD,IAAA,IAAI,SAAS,SAAW,EAAA;AACtB,MAAO,OAAA,IAAA;AAAA;AAET,IAAI,IAAA,CAAC,SAAS,KAAO,EAAA;AACnB,MAAO,OAAA,KAAA;AAAA;AAET,IAAO,OAAA,MAAA,CAAO,QAAS,CAAA,QAAA,CAAS,KAAK,CAAA;AAAA,GACvC;AAAA,EACA,OAAS,EAAA,CAAC,EAAE,MAAA,EAAc,MAAA;AAAA,IACxB,GAAK,EAAA,QAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACV;AACF,CAAC,CAAA;AAEM,MAAM,SAAY,GAAA;AAAA,EACvB,MAAM,OAAQ,CAAA,IAAA;AAAA,EACd,aAAa,OAAQ,CAAA,WAAA;AAAA,EACrB,cAAc,OAAQ,CAAA,YAAA;AAAA,EACtB,YAAA,EAAcC,iCAAgB,OAAQ,CAAA,YAAA,IAAgBD,MAAE,MAAO,CAAA,EAAE,CAAC;AACpE;AAEa,MAAA,KAAA,GAAQ,EAAE,OAAQ;;;;;"}
1
+ {"version":3,"file":"rules.cjs.js","sources":["../../src/permissions/rules.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createPermissionRule } from '@backstage/plugin-permission-node';\nimport { z as zod3 } from 'zod/v3';\nimport { z as zod4 } from 'zod/v4';\n\nimport { permissionMetadataResourceRef } from './resource';\nimport { RoleMetadataDao } from '../database/role-metadata';\n\n/**\n * The RBACFilter is a simple filter without any conditional criteria.\n *\n */\nexport type RBACFilter = {\n key: string;\n values: any[];\n};\n\n/**\n * The RBACFilters type is a recursive type that can be used to create complex filter structures.\n * It can be used to create filters that are a combination of other filters, or a negation of a filter.\n *\n */\nexport type RBACFilters =\n | { anyOf: RBACFilters[] }\n | { allOf: RBACFilters[] }\n | { not: RBACFilters }\n | RBACFilter;\n\nconst isOwner = createPermissionRule({\n name: 'IS_OWNER',\n description:\n 'Should allow access to RBAC roles and Permissions through ownership',\n resourceRef: permissionMetadataResourceRef,\n paramsSchema: zod3.object({\n owners: zod3\n .string()\n .array()\n .describe('List of entity refs to match against'),\n }),\n apply: (roleMeta: RoleMetadataDao, { owners }) => {\n if (roleMeta.isDefault) {\n return true;\n }\n if (!roleMeta.owner) {\n return false;\n }\n return owners.includes(roleMeta.owner);\n },\n toQuery: ({ owners }) => ({\n key: 'owners',\n values: owners,\n }),\n});\n\nexport const rbacRules = {\n name: isOwner.name,\n description: isOwner.description,\n resourceType: isOwner.resourceType,\n paramsSchema: zod4\n .object({\n owners: zod4\n .string()\n .array()\n .describe('List of entity refs to match against'),\n })\n .toJSONSchema(),\n};\n\nexport const rules = { isOwner };\n"],"names":["createPermissionRule","permissionMetadataResourceRef","zod3","zod4"],"mappings":";;;;;;;AA0CA,MAAM,UAAUA,yCAAqB,CAAA;AAAA,EACnC,IAAM,EAAA,UAAA;AAAA,EACN,WACE,EAAA,qEAAA;AAAA,EACF,WAAa,EAAAC,sCAAA;AAAA,EACb,YAAA,EAAcC,KAAK,MAAO,CAAA;AAAA,IACxB,QAAQA,IACL,CAAA,MAAA,GACA,KAAM,EAAA,CACN,SAAS,sCAAsC;AAAA,GACnD,CAAA;AAAA,EACD,KAAO,EAAA,CAAC,QAA2B,EAAA,EAAE,QAAa,KAAA;AAChD,IAAA,IAAI,SAAS,SAAW,EAAA;AACtB,MAAO,OAAA,IAAA;AAAA;AAET,IAAI,IAAA,CAAC,SAAS,KAAO,EAAA;AACnB,MAAO,OAAA,KAAA;AAAA;AAET,IAAO,OAAA,MAAA,CAAO,QAAS,CAAA,QAAA,CAAS,KAAK,CAAA;AAAA,GACvC;AAAA,EACA,OAAS,EAAA,CAAC,EAAE,MAAA,EAAc,MAAA;AAAA,IACxB,GAAK,EAAA,QAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACV;AACF,CAAC,CAAA;AAEM,MAAM,SAAY,GAAA;AAAA,EACvB,MAAM,OAAQ,CAAA,IAAA;AAAA,EACd,aAAa,OAAQ,CAAA,WAAA;AAAA,EACrB,cAAc,OAAQ,CAAA,YAAA;AAAA,EACtB,YAAA,EAAcC,KACX,MAAO,CAAA;AAAA,IACN,QAAQA,IACL,CAAA,MAAA,GACA,KAAM,EAAA,CACN,SAAS,sCAAsC;AAAA,GACnD,EACA,YAAa;AAClB;AAEa,MAAA,KAAA,GAAQ,EAAE,OAAQ;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-rbac-backend",
3
- "version": "7.11.0",
3
+ "version": "7.12.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -36,16 +36,16 @@
36
36
  "postpack": "backstage-cli package postpack"
37
37
  },
38
38
  "dependencies": {
39
- "@backstage-community/plugin-rbac-common": "^1.25.0",
40
- "@backstage-community/plugin-rbac-node": "^1.19.1",
41
- "@backstage/backend-defaults": "^0.15.2",
42
- "@backstage/backend-plugin-api": "^1.7.0",
43
- "@backstage/catalog-client": "^1.13.0",
44
- "@backstage/catalog-model": "^1.7.6",
39
+ "@backstage-community/plugin-rbac-common": "^1.26.0",
40
+ "@backstage-community/plugin-rbac-node": "^1.20.0",
41
+ "@backstage/backend-defaults": "^0.16.0",
42
+ "@backstage/backend-plugin-api": "^1.8.0",
43
+ "@backstage/catalog-client": "^1.14.0",
44
+ "@backstage/catalog-model": "^1.7.7",
45
45
  "@backstage/config": "^1.3.6",
46
46
  "@backstage/errors": "^1.2.7",
47
- "@backstage/plugin-permission-common": "^0.9.6",
48
- "@backstage/plugin-permission-node": "^0.10.10",
47
+ "@backstage/plugin-permission-common": "^0.9.7",
48
+ "@backstage/plugin-permission-node": "^0.10.11",
49
49
  "@dagrejs/graphlib": "^2.1.13",
50
50
  "casbin": "^5.27.1",
51
51
  "chokidar": "^3.6.0",
@@ -56,14 +56,13 @@
56
56
  "knex": "^3.0.0",
57
57
  "lodash": "^4.17.21",
58
58
  "typeorm-adapter": "^1.6.1",
59
- "zod": "^3.25.76",
60
- "zod-to-json-schema": "^3.25.1"
59
+ "zod": "^4.3.6"
61
60
  },
62
61
  "devDependencies": {
63
- "@backstage/backend-test-utils": "^1.11.0",
64
- "@backstage/cli": "^0.35.4",
65
- "@backstage/core-plugin-api": "^1.12.3",
66
- "@backstage/plugin-catalog-node": "^2.0.0",
62
+ "@backstage/backend-test-utils": "^1.11.1",
63
+ "@backstage/cli": "^0.36.0",
64
+ "@backstage/core-plugin-api": "^1.12.4",
65
+ "@backstage/plugin-catalog-node": "^2.1.0",
67
66
  "@backstage/types": "^1.2.2",
68
67
  "@types/express": "4.17.25",
69
68
  "@types/js-yaml": "^4.0.9",