namirasoft-access 1.3.13 → 1.3.15
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/AccessControl.js +1 -1
- package/dist/AccessControl.js.map +1 -1
- package/dist/NamirasoftAccessServerBase.js +1 -1
- package/dist/NamirasoftAccessServerProduct.d.ts +6 -0
- package/dist/NamirasoftAccessServerProduct.js +10 -0
- package/dist/NamirasoftAccessServerProduct.js.map +1 -1
- package/dist/command/ProductCommand.js +2 -0
- package/dist/command/ProductCommand.js.map +1 -1
- package/dist/command/ProductListCommand.d.ts +5 -0
- package/dist/command/ProductListCommand.js +37 -0
- package/dist/command/ProductListCommand.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/row/ProductRow.d.ts +4 -0
- package/dist/row/ProductRow.js +3 -0
- package/dist/row/ProductRow.js.map +1 -0
- package/package.json +2 -2
- package/src/AccessControl.ts +1 -1
- package/src/NamirasoftAccessServerBase.ts +1 -1
- package/src/NamirasoftAccessServerProduct.ts +10 -0
- package/src/command/ProductCommand.ts +2 -0
- package/src/command/ProductListCommand.ts +44 -0
- package/src/index.ts +2 -0
- package/src/row/ProductRow.ts +25 -0
package/dist/AccessControl.js
CHANGED
|
@@ -5,7 +5,7 @@ class AccessControl {
|
|
|
5
5
|
static isValid(policies, product_id, entity, action, id) {
|
|
6
6
|
for (let i = 0; i < policies.length; i++) {
|
|
7
7
|
const element = policies[i];
|
|
8
|
-
if (element.product_id === product_id)
|
|
8
|
+
if (element.product_id == "*" || element.product_id === product_id)
|
|
9
9
|
if (element.entity == "*" || element.entity === entity)
|
|
10
10
|
if (element.actions == "*" || element.actions.split(";").includes(action))
|
|
11
11
|
if (element.resources == "*" || id === null || element.resources.split(";").includes(id))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessControl.js","sourceRoot":"","sources":["../src/AccessControl.ts"],"names":[],"mappings":";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= void 0;
|
|
|
4
4
|
const namirasoft_account_1 = require("namirasoft-account");
|
|
5
5
|
class NamirasoftAccessServerBase extends namirasoft_account_1.NamirasoftServerBase {
|
|
6
6
|
constructor(manager, onError) {
|
|
7
|
-
super(`https://access.namirasoft.com/api/v1`, `1.3.
|
|
7
|
+
super(`https://access.namirasoft.com/api/v1`, `1.3.15`, manager, onError);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.NamirasoftAccessServerBase = NamirasoftAccessServerBase;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { FilterItem } from "namirasoft-core";
|
|
1
2
|
import { NamirasoftAccessServerBase } from "./NamirasoftAccessServerBase";
|
|
3
|
+
import { ProductRow } from "./row/ProductRow";
|
|
2
4
|
import { TokenManager } from "namirasoft-account";
|
|
3
5
|
export declare class NamirasoftAccessServerProduct extends NamirasoftAccessServerBase {
|
|
4
6
|
constructor(manager: TokenManager, onError: (error: Error) => void);
|
|
7
|
+
List(filters: FilterItem[] | null, page: (number | null), size: (number | null)): Promise<{
|
|
8
|
+
rows: ProductRow[];
|
|
9
|
+
count: (number | null);
|
|
10
|
+
}>;
|
|
5
11
|
Set(product_id: string, body: any): Promise<void>;
|
|
6
12
|
}
|
|
@@ -10,12 +10,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.NamirasoftAccessServerProduct = void 0;
|
|
13
|
+
const namirasoft_core_1 = require("namirasoft-core");
|
|
13
14
|
const NamirasoftAccessServerBase_1 = require("./NamirasoftAccessServerBase");
|
|
14
15
|
class NamirasoftAccessServerProduct extends NamirasoftAccessServerBase_1.NamirasoftAccessServerBase {
|
|
15
16
|
constructor(manager, onError) {
|
|
16
17
|
super(manager, onError);
|
|
18
|
+
this.List = this.List.bind(this);
|
|
17
19
|
this.Set = this.Set.bind(this);
|
|
18
20
|
}
|
|
21
|
+
List(filters, page, size) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
let filters_string_value = namirasoft_core_1.FilterItem.stringify(filters);
|
|
24
|
+
let path = `/product/list`;
|
|
25
|
+
let { data } = yield this._get(path, { filters: filters_string_value, page, size });
|
|
26
|
+
return data;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
19
29
|
Set(product_id, body) {
|
|
20
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
31
|
let path = `/product/${product_id}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NamirasoftAccessServerProduct.js","sourceRoot":"","sources":["../src/NamirasoftAccessServerProduct.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6EAA0E;
|
|
1
|
+
{"version":3,"file":"NamirasoftAccessServerProduct.js","sourceRoot":"","sources":["../src/NamirasoftAccessServerProduct.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,qDAA6C;AAC7C,6EAA0E;AAI1E,MAAa,6BAA8B,SAAQ,uDAA0B;IAEzE,YAAY,OAAqB,EAAE,OAA+B;QAE9D,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACK,IAAI,CAAC,OAA4B,EAAE,IAAqB,EAAE,IAAqB;;YAEjF,IAAI,oBAAoB,GAAW,4BAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACjE,IAAI,IAAI,GAAG,eAAe,CAAC;YAC3B,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAiD,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACpI,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;IACK,GAAG,CAAC,UAAkB,EAAE,IAAS;;YAEnC,IAAI,IAAI,GAAG,YAAY,UAAU,EAAE,CAAC;YACpC,MAAM,IAAI,CAAC,IAAI,CAAO,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QAC1C,CAAC;KAAA;CACJ;AApBD,sEAoBC;AAAA,CAAC"}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProductCommand = void 0;
|
|
4
4
|
const namirasoft_node_cli_1 = require("namirasoft-node-cli");
|
|
5
|
+
const ProductListCommand_1 = require("./ProductListCommand");
|
|
5
6
|
const ProductSetCommand_1 = require("./ProductSetCommand");
|
|
6
7
|
class ProductCommand extends namirasoft_node_cli_1.BaseNavigatorCommand {
|
|
7
8
|
constructor(argv) {
|
|
8
9
|
super(argv, {
|
|
10
|
+
"list": ProductListCommand_1.ProductListCommand,
|
|
9
11
|
"set": ProductSetCommand_1.ProductSetCommand,
|
|
10
12
|
});
|
|
11
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCommand.js","sourceRoot":"","sources":["../../src/command/ProductCommand.ts"],"names":[],"mappings":";;;AAoBA,6DAA2D;AAC3D,2DAAwD;AAExD,MAAa,cAAe,SAAQ,0CAAoB;IAEpD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE;YACR,KAAK,EAAE,qCAAiB;SAC3B,CAAC,CAAC;IACP,CAAC;CACJ;
|
|
1
|
+
{"version":3,"file":"ProductCommand.js","sourceRoot":"","sources":["../../src/command/ProductCommand.ts"],"names":[],"mappings":";;;AAoBA,6DAA2D;AAC3D,6DAA0D;AAC1D,2DAAwD;AAExD,MAAa,cAAe,SAAQ,0CAAoB;IAEpD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE;YACR,MAAM,EAAE,uCAAkB;YAC1B,KAAK,EAAE,qCAAiB;SAC3B,CAAC,CAAC;IACP,CAAC;CACJ;AATD,wCASC;AAAA,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ProductListCommand = void 0;
|
|
13
|
+
const namirasoft_node_cli_1 = require("namirasoft-node-cli");
|
|
14
|
+
const namirasoft_core_1 = require("namirasoft-core");
|
|
15
|
+
const NamirasoftAccessServer_1 = require("../NamirasoftAccessServer");
|
|
16
|
+
const namirasoft_account_1 = require("namirasoft-account");
|
|
17
|
+
class ProductListCommand extends namirasoft_node_cli_1.BaseFinalCommand {
|
|
18
|
+
constructor(argv) {
|
|
19
|
+
super(argv, ["filters", "page", "size"], []);
|
|
20
|
+
}
|
|
21
|
+
exec() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
let token = this.app.storage.getNSAToken();
|
|
24
|
+
if (token == null)
|
|
25
|
+
throw new Error("Token is not available. Please login first using:\nns-access account config \nor \n{this.command} account login.");
|
|
26
|
+
let storage = new namirasoft_core_1.IStorageMemory();
|
|
27
|
+
let manager = new namirasoft_account_1.TokenManager(storage, () => { });
|
|
28
|
+
manager.setValue(token, false);
|
|
29
|
+
let server = new NamirasoftAccessServer_1.NamirasoftAccessServer(manager, e => this.app.logger.error(e.message));
|
|
30
|
+
let ans = yield server.product.List(this.arg_values[0], this.arg_values[1], this.arg_values[2]);
|
|
31
|
+
this.app.logger.success(JSON.stringify(ans));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.ProductListCommand = ProductListCommand;
|
|
36
|
+
;
|
|
37
|
+
//# sourceMappingURL=ProductListCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductListCommand.js","sourceRoot":"","sources":["../../src/command/ProductListCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAAiD;AACjD,sEAAmE;AACnE,2DAAkD;AAElD,MAAa,kBAAmB,SAAQ,sCAAgB;IAEpD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IACc,IAAI;;YAEf,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC3C,IAAI,KAAK,IAAI,IAAI;gBACb,MAAM,IAAI,KAAK,CAAC,kHAAkH,CAAC,CAAC;YACxI,IAAI,OAAO,GAAG,IAAI,gCAAc,EAAE,CAAC;YACnC,IAAI,OAAO,GAAG,IAAI,iCAAY,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACnD,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC/B,IAAI,MAAM,GAAG,IAAI,+CAAsB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACxF,IAAI,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YAChG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ;AAlBD,gDAkBC;AAAA,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ export * from "./command/PolicyTagListCommand";
|
|
|
77
77
|
export * from "./command/PolicyTagUpdateCommand";
|
|
78
78
|
export * from "./command/PolicyUpdateCommand";
|
|
79
79
|
export * from "./command/ProductCommand";
|
|
80
|
+
export * from "./command/ProductListCommand";
|
|
80
81
|
export * from "./command/ProductSetCommand";
|
|
81
82
|
export * from "./command/RoleCategoryCommand";
|
|
82
83
|
export * from "./command/RoleCategoryCreateCommand";
|
|
@@ -133,6 +134,7 @@ export * from "./row/PolicyFieldRow";
|
|
|
133
134
|
export * from "./row/PolicyInputRow";
|
|
134
135
|
export * from "./row/PolicyRow";
|
|
135
136
|
export * from "./row/PolicyTagRow";
|
|
137
|
+
export * from "./row/ProductRow";
|
|
136
138
|
export * from "./row/RoleCategoryRow";
|
|
137
139
|
export * from "./row/RoleFieldRow";
|
|
138
140
|
export * from "./row/RoleInputRow";
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ __exportStar(require("./command/PolicyTagListCommand"), exports);
|
|
|
93
93
|
__exportStar(require("./command/PolicyTagUpdateCommand"), exports);
|
|
94
94
|
__exportStar(require("./command/PolicyUpdateCommand"), exports);
|
|
95
95
|
__exportStar(require("./command/ProductCommand"), exports);
|
|
96
|
+
__exportStar(require("./command/ProductListCommand"), exports);
|
|
96
97
|
__exportStar(require("./command/ProductSetCommand"), exports);
|
|
97
98
|
__exportStar(require("./command/RoleCategoryCommand"), exports);
|
|
98
99
|
__exportStar(require("./command/RoleCategoryCreateCommand"), exports);
|
|
@@ -149,6 +150,7 @@ __exportStar(require("./row/PolicyFieldRow"), exports);
|
|
|
149
150
|
__exportStar(require("./row/PolicyInputRow"), exports);
|
|
150
151
|
__exportStar(require("./row/PolicyRow"), exports);
|
|
151
152
|
__exportStar(require("./row/PolicyTagRow"), exports);
|
|
153
|
+
__exportStar(require("./row/ProductRow"), exports);
|
|
152
154
|
__exportStar(require("./row/RoleCategoryRow"), exports);
|
|
153
155
|
__exportStar(require("./row/RoleFieldRow"), exports);
|
|
154
156
|
__exportStar(require("./row/RoleInputRow"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA,kDAAgC;AAChC,2DAAyC;AACzC,iEAA+C;AAC/C,+DAA6C;AAC7C,kEAAgD;AAChD,qEAAmD;AACnD,6EAA2D;AAC3D,0EAAwD;AACxD,wEAAsD;AACtD,iEAA+C;AAC/C,yEAAuD;AACvD,sEAAoD;AACpD,oEAAkD;AAClD,kEAAgD;AAChD,+DAA6C;AAC7C,uEAAqD;AACrD,oEAAkD;AAClD,kEAAgD;AAChD,gEAA8C;AAC9C,0DAAwC;AACxC,6DAA2C;AAC3C,kEAAgD;AAChD,2DAAyC;AACzC,8DAA4C;AAC5C,sEAAoD;AACpD,4EAA0D;AAC1D,4EAA0D;AAC1D,yEAAuD;AACvD,0EAAwD;AACxD,4EAA0D;AAC1D,8DAA4C;AAC5C,oEAAkD;AAClD,oEAAkD;AAClD,mEAAiD;AACjD,yEAAuD;AACvD,yEAAuD;AACvD,sEAAoD;AACpD,uEAAqD;AACrD,yEAAuD;AACvD,iEAA+C;AAC/C,yEAAuD;AACvD,yEAAuD;AACvD,kEAAgD;AAChD,0EAAwD;AACxD,0EAAwD;AACxD,iEAA+C;AAC/C,uEAAqD;AACrD,uEAAqD;AACrD,oEAAkD;AAClD,qEAAmD;AACnD,uEAAqD;AAC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AgC;AAChC,qDAAmC;AACnC,wDAAsC;AACtC,qDAAmC;AACnC,qDAAmC;AACnC,gDAA8B;AAC9B,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA,kDAAgC;AAChC,2DAAyC;AACzC,iEAA+C;AAC/C,+DAA6C;AAC7C,kEAAgD;AAChD,qEAAmD;AACnD,6EAA2D;AAC3D,0EAAwD;AACxD,wEAAsD;AACtD,iEAA+C;AAC/C,yEAAuD;AACvD,sEAAoD;AACpD,oEAAkD;AAClD,kEAAgD;AAChD,+DAA6C;AAC7C,uEAAqD;AACrD,oEAAkD;AAClD,kEAAgD;AAChD,gEAA8C;AAC9C,0DAAwC;AACxC,6DAA2C;AAC3C,kEAAgD;AAChD,2DAAyC;AACzC,8DAA4C;AAC5C,sEAAoD;AACpD,4EAA0D;AAC1D,4EAA0D;AAC1D,yEAAuD;AACvD,0EAAwD;AACxD,4EAA0D;AAC1D,8DAA4C;AAC5C,oEAAkD;AAClD,oEAAkD;AAClD,mEAAiD;AACjD,yEAAuD;AACvD,yEAAuD;AACvD,sEAAoD;AACpD,uEAAqD;AACrD,yEAAuD;AACvD,iEAA+C;AAC/C,yEAAuD;AACvD,yEAAuD;AACvD,kEAAgD;AAChD,0EAAwD;AACxD,0EAAwD;AACxD,iEAA+C;AAC/C,uEAAqD;AACrD,uEAAqD;AACrD,oEAAkD;AAClD,qEAAmD;AACnD,uEAAqD;AACrD,oEAAkD;AAClD,kEAAgD;AAChD,wEAAsD;AACtD,wEAAsD;AACtD,qEAAmD;AACnD,sEAAoD;AACpD,wEAAsD;AACtD,0DAAwC;AACxC,gEAA8C;AAC9C,gEAA8C;AAC9C,+DAA6C;AAC7C,qEAAmD;AACnD,qEAAmD;AACnD,kEAAgD;AAChD,mEAAiD;AACjD,qEAAmD;AACnD,6DAA2C;AAC3C,qEAAmD;AACnD,8DAA4C;AAC5C,sEAAoD;AACpD,6DAA2C;AAC3C,mEAAiD;AACjD,mEAAiD;AACjD,gEAA8C;AAC9C,iEAA+C;AAC/C,mEAAiD;AACjD,gEAA8C;AAC9C,2DAAyC;AACzC,+DAA6C;AAC7C,8DAA4C;AAC5C,gEAA8C;AAC9C,sEAAoD;AACpD,sEAAoD;AACpD,mEAAiD;AACjD,oEAAkD;AAClD,sEAAoD;AACpD,wDAAsC;AACtC,8DAA4C;AAC5C,8DAA4C;AAC5C,6DAA2C;AAC3C,mEAAiD;AACjD,mEAAiD;AACjD,gEAA8C;AAC9C,iEAA+C;AAC/C,mEAAiD;AACjD,2DAAyC;AACzC,mEAAiD;AACjD,4DAA0C;AAC1C,oEAAkD;AAClD,2DAAyC;AACzC,iEAA+C;AAC/C,iEAA+C;AAC/C,8DAA4C;AAC5C,+DAA6C;AAC7C,iEAA+C;AAC/C,8DAA4C;AAC5C,yDAAuC;AACvC,6DAA2C;AAC3C,sDAAoC;AACpC,qEAAmD;AACnD,kEAAgD;AAChD,6DAA2C;AAC3C,gEAA8C;AAC9C,iEAA+C;AAC/C,8DAA4C;AAC5C,yDAAuC;AACvC,4DAA0C;AAC1C,+DAA6C;AAC7C,4DAA0C;AAC1C,uDAAqC;AACrC,0DAAwC;AACxC,kDAAgC;AAChC,+DAA6C;AAC7C,4DAA0C;AAC1C,0DAAwC;AACxC,8DAA4C;AAC5C,2DAAyC;AACzC,2DAAyC;AACzC,sDAAoC;AACpC,yDAAuC;AACvC,0DAAwC;AACxC,uDAAqC;AACrC,uDAAqC;AACrC,kDAAgC;AAChC,qDAAmC;AACnC,mDAAiC;AACjC,wDAAsC;AACtC,qDAAmC;AACnC,qDAAmC;AACnC,gDAA8B;AAC9B,mDAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductRow.js","sourceRoot":"","sources":["../../src/row/ProductRow.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.3.
|
|
11
|
+
"version": "1.3.15",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"namirasoft-core": "^1.3.67",
|
|
21
|
-
"namirasoft-site": "^1.3.
|
|
21
|
+
"namirasoft-site": "^1.3.5",
|
|
22
22
|
"namirasoft-node-cli": "^1.3.8",
|
|
23
23
|
"namirasoft-account": "^1.3.29"
|
|
24
24
|
},
|
package/src/AccessControl.ts
CHANGED
|
@@ -7,7 +7,7 @@ export class AccessControl
|
|
|
7
7
|
for (let i = 0; i < policies.length; i++)
|
|
8
8
|
{
|
|
9
9
|
const element = policies[i];
|
|
10
|
-
if (element.product_id === product_id)
|
|
10
|
+
if (element.product_id == "*" || element.product_id === product_id)
|
|
11
11
|
if (element.entity == "*" || element.entity === entity)
|
|
12
12
|
if (element.actions == "*" || element.actions.split(";").includes(action))
|
|
13
13
|
if (element.resources == "*" || id === null || element.resources.split(";").includes(id))
|
|
@@ -25,6 +25,6 @@ export class NamirasoftAccessServerBase extends NamirasoftServerBase
|
|
|
25
25
|
{
|
|
26
26
|
constructor(manager: TokenManager, onError: (error: Error) => void)
|
|
27
27
|
{
|
|
28
|
-
super(`https://access.namirasoft.com/api/v1`, `1.3.
|
|
28
|
+
super(`https://access.namirasoft.com/api/v1`, `1.3.15`, manager, onError);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
/* */
|
|
19
19
|
/****************************************************************/
|
|
20
20
|
|
|
21
|
+
import { FilterItem } from "namirasoft-core";
|
|
21
22
|
import { NamirasoftAccessServerBase } from "./NamirasoftAccessServerBase";
|
|
23
|
+
import { ProductRow } from "./row/ProductRow";
|
|
22
24
|
import { TokenManager } from "namirasoft-account";
|
|
23
25
|
|
|
24
26
|
export class NamirasoftAccessServerProduct extends NamirasoftAccessServerBase
|
|
@@ -26,8 +28,16 @@ export class NamirasoftAccessServerProduct extends NamirasoftAccessServerBase
|
|
|
26
28
|
constructor(manager: TokenManager, onError: (error: Error) => void)
|
|
27
29
|
{
|
|
28
30
|
super(manager, onError);
|
|
31
|
+
this.List = this.List.bind(this);
|
|
29
32
|
this.Set = this.Set.bind(this);
|
|
30
33
|
}
|
|
34
|
+
async List(filters: FilterItem[] | null, page: (number | null), size: (number | null)): Promise<{ rows: ProductRow[], count: (number | null) }>
|
|
35
|
+
{
|
|
36
|
+
let filters_string_value: string = FilterItem.stringify(filters);
|
|
37
|
+
let path = `/product/list`;
|
|
38
|
+
let { data } = await this._get<{ rows: ProductRow[], count: (number | null) }>(path, { filters: filters_string_value, page, size });
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
31
41
|
async Set(product_id: string, body: any): Promise<void>
|
|
32
42
|
{
|
|
33
43
|
let path = `/product/${product_id}`;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
/****************************************************************/
|
|
20
20
|
|
|
21
21
|
import { BaseNavigatorCommand } from "namirasoft-node-cli";
|
|
22
|
+
import { ProductListCommand } from "./ProductListCommand";
|
|
22
23
|
import { ProductSetCommand } from "./ProductSetCommand";
|
|
23
24
|
|
|
24
25
|
export class ProductCommand extends BaseNavigatorCommand
|
|
@@ -26,6 +27,7 @@ export class ProductCommand extends BaseNavigatorCommand
|
|
|
26
27
|
constructor(argv: string[])
|
|
27
28
|
{
|
|
28
29
|
super(argv, {
|
|
30
|
+
"list": ProductListCommand,
|
|
29
31
|
"set": ProductSetCommand,
|
|
30
32
|
});
|
|
31
33
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/****************************************************************/
|
|
2
|
+
/* */
|
|
3
|
+
/* This is an Auto-Generated File */
|
|
4
|
+
/* Made By */
|
|
5
|
+
/* Namirasoft SDK Generator NPM Package */
|
|
6
|
+
/* */
|
|
7
|
+
/****************************************************************/
|
|
8
|
+
/****************************************************************/
|
|
9
|
+
/* */
|
|
10
|
+
/* Please do not make any change to this file */
|
|
11
|
+
/* If any changed is reqired, ns-sdkg command must be used */
|
|
12
|
+
/* */
|
|
13
|
+
/****************************************************************/
|
|
14
|
+
/****************************************************************/
|
|
15
|
+
/* */
|
|
16
|
+
/* Namira Software Corporation */
|
|
17
|
+
/* https://namirasoft.com */
|
|
18
|
+
/* */
|
|
19
|
+
/****************************************************************/
|
|
20
|
+
|
|
21
|
+
import { BaseFinalCommand } from "namirasoft-node-cli";
|
|
22
|
+
import { IStorageMemory } from "namirasoft-core";
|
|
23
|
+
import { NamirasoftAccessServer } from "../NamirasoftAccessServer";
|
|
24
|
+
import { TokenManager } from "namirasoft-account";
|
|
25
|
+
|
|
26
|
+
export class ProductListCommand extends BaseFinalCommand
|
|
27
|
+
{
|
|
28
|
+
constructor(argv: string[])
|
|
29
|
+
{
|
|
30
|
+
super(argv, ["filters", "page", "size"], []);
|
|
31
|
+
}
|
|
32
|
+
override async exec()
|
|
33
|
+
{
|
|
34
|
+
let token = this.app.storage.getNSAToken();
|
|
35
|
+
if (token == null)
|
|
36
|
+
throw new Error("Token is not available. Please login first using:\nns-access account config \nor \n{this.command} account login.");
|
|
37
|
+
let storage = new IStorageMemory();
|
|
38
|
+
let manager = new TokenManager(storage, () => { });
|
|
39
|
+
manager.setValue(token, false);
|
|
40
|
+
let server = new NamirasoftAccessServer(manager, e => this.app.logger.error(e.message));
|
|
41
|
+
let ans = await server.product.List(this.arg_values[0], this.arg_values[1], this.arg_values[2]);
|
|
42
|
+
this.app.logger.success(JSON.stringify(ans));
|
|
43
|
+
}
|
|
44
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -97,6 +97,7 @@ export * from "./command/PolicyTagListCommand";
|
|
|
97
97
|
export * from "./command/PolicyTagUpdateCommand";
|
|
98
98
|
export * from "./command/PolicyUpdateCommand";
|
|
99
99
|
export * from "./command/ProductCommand";
|
|
100
|
+
export * from "./command/ProductListCommand";
|
|
100
101
|
export * from "./command/ProductSetCommand";
|
|
101
102
|
export * from "./command/RoleCategoryCommand";
|
|
102
103
|
export * from "./command/RoleCategoryCreateCommand";
|
|
@@ -153,6 +154,7 @@ export * from "./row/PolicyFieldRow";
|
|
|
153
154
|
export * from "./row/PolicyInputRow";
|
|
154
155
|
export * from "./row/PolicyRow";
|
|
155
156
|
export * from "./row/PolicyTagRow";
|
|
157
|
+
export * from "./row/ProductRow";
|
|
156
158
|
export * from "./row/RoleCategoryRow";
|
|
157
159
|
export * from "./row/RoleFieldRow";
|
|
158
160
|
export * from "./row/RoleInputRow";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/****************************************************************/
|
|
2
|
+
/* */
|
|
3
|
+
/* This is an Auto-Generated File */
|
|
4
|
+
/* Made By */
|
|
5
|
+
/* Namirasoft SDK Generator NPM Package */
|
|
6
|
+
/* */
|
|
7
|
+
/****************************************************************/
|
|
8
|
+
/****************************************************************/
|
|
9
|
+
/* */
|
|
10
|
+
/* Please do not make any change to this file */
|
|
11
|
+
/* If any changed is reqired, ns-sdkg command must be used */
|
|
12
|
+
/* */
|
|
13
|
+
/****************************************************************/
|
|
14
|
+
/****************************************************************/
|
|
15
|
+
/* */
|
|
16
|
+
/* Namira Software Corporation */
|
|
17
|
+
/* https://namirasoft.com */
|
|
18
|
+
/* */
|
|
19
|
+
/****************************************************************/
|
|
20
|
+
|
|
21
|
+
export type ProductRow =
|
|
22
|
+
{
|
|
23
|
+
id: string;
|
|
24
|
+
access: any;
|
|
25
|
+
}
|