ais_auth_lib 1.0.7 → 1.0.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/dist/filter.js CHANGED
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkResourceMatchWithRules = exports.filterObjects = void 0;
4
4
  const conditions_1 = require("./conditions");
5
5
  function filterObjects(objects, rules) {
6
+ const rulesWithoutCreateAction = rules.map((rule) => ({
7
+ ...rule,
8
+ actions: rule.actions.filter((action) => action !== "create"),
9
+ })).filter(rule => rule.actions.length > 0);
6
10
  return objects.filter((obj) => {
7
- return checkResourceMatchWithRules(obj, rules);
11
+ return checkResourceMatchWithRules(obj, rulesWithoutCreateAction);
8
12
  });
9
13
  }
10
14
  exports.filterObjects = filterObjects;
@@ -24,7 +28,7 @@ function checkResourceMatchWithRules(obj, rules) {
24
28
  }
25
29
  }
26
30
  if (ruleResult) {
27
- actions.add(rule.action);
31
+ rule.actions.forEach((action) => actions.add(action));
28
32
  }
29
33
  overallResult = overallResult || ruleResult;
30
34
  }
@@ -4,7 +4,7 @@ export interface Rule {
4
4
  resource: string;
5
5
  appName: string;
6
6
  name: string;
7
- action: string;
7
+ actions: string[];
8
8
  description: string;
9
9
  conditionGroups: ConditionGroup[];
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ais_auth_lib",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "auth lib for microservices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",