namirasoft-access 1.4.63 → 1.4.64

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.
Files changed (153) hide show
  1. package/dist/AccessControl.js +3 -0
  2. package/dist/AccessControl.js.map +1 -1
  3. package/dist/NamirasoftAccessServer.js +1 -1
  4. package/package.json +27 -27
  5. package/src/AccessControl.ts +83 -80
  6. package/src/NamirasoftAccessServer.ts +80 -80
  7. package/src/NamirasoftAccessServerAccess.ts +43 -43
  8. package/src/NamirasoftAccessServerBase.ts +29 -29
  9. package/src/NamirasoftAccessServerHealthz.ts +35 -35
  10. package/src/NamirasoftAccessServerPermission.ts +108 -108
  11. package/src/NamirasoftAccessServerPermissionCategory.ts +62 -62
  12. package/src/NamirasoftAccessServerPermissionField.ts +69 -69
  13. package/src/NamirasoftAccessServerPermissionTag.ts +69 -69
  14. package/src/NamirasoftAccessServerPolicy.ts +86 -86
  15. package/src/NamirasoftAccessServerPolicyCategory.ts +62 -62
  16. package/src/NamirasoftAccessServerPolicyField.ts +69 -69
  17. package/src/NamirasoftAccessServerPolicyTag.ts +69 -69
  18. package/src/NamirasoftAccessServerProduct.ts +54 -54
  19. package/src/NamirasoftAccessServerRole.ts +86 -86
  20. package/src/NamirasoftAccessServerRoleCategory.ts +62 -62
  21. package/src/NamirasoftAccessServerRoleField.ts +69 -69
  22. package/src/NamirasoftAccessServerRoleTag.ts +69 -69
  23. package/src/NamirasoftAccessServerUserRole.ts +35 -35
  24. package/src/NamirasoftAccessServerValue.ts +36 -36
  25. package/src/command/AccessCommand.ts +33 -33
  26. package/src/command/AccessSetOwnerCommand.ts +55 -55
  27. package/src/command/Access_GetForCommand.ts +44 -44
  28. package/src/command/HealthzCommand.ts +31 -31
  29. package/src/command/HealthzGetCommand.ts +44 -44
  30. package/src/command/PermissionCategoryCommand.ts +37 -37
  31. package/src/command/PermissionCategoryCreateCommand.ts +55 -55
  32. package/src/command/PermissionCategoryDeleteCommand.ts +44 -44
  33. package/src/command/PermissionCategoryGetCommand.ts +44 -44
  34. package/src/command/PermissionCategoryListCommand.ts +44 -44
  35. package/src/command/PermissionCommand.ts +49 -49
  36. package/src/command/PermissionCreateCommand.ts +100 -100
  37. package/src/command/PermissionDeleteIncomingCommand.ts +44 -44
  38. package/src/command/PermissionDeleteOutgoingCommand.ts +44 -44
  39. package/src/command/PermissionFieldCommand.ts +39 -39
  40. package/src/command/PermissionFieldCreateCommand.ts +64 -64
  41. package/src/command/PermissionFieldDeleteCommand.ts +44 -44
  42. package/src/command/PermissionFieldGetCommand.ts +44 -44
  43. package/src/command/PermissionFieldListCommand.ts +44 -44
  44. package/src/command/PermissionFieldUpdateCommand.ts +64 -64
  45. package/src/command/PermissionGetCommand.ts +44 -44
  46. package/src/command/PermissionGetIncomingCommand.ts +44 -44
  47. package/src/command/PermissionGetOutgoingCommand.ts +44 -44
  48. package/src/command/PermissionListCommand.ts +44 -44
  49. package/src/command/PermissionListIncomingCommand.ts +44 -44
  50. package/src/command/PermissionListOutgoingCommand.ts +44 -44
  51. package/src/command/PermissionTagCommand.ts +39 -39
  52. package/src/command/PermissionTagCreateCommand.ts +64 -64
  53. package/src/command/PermissionTagDeleteCommand.ts +44 -44
  54. package/src/command/PermissionTagGetCommand.ts +44 -44
  55. package/src/command/PermissionTagListCommand.ts +44 -44
  56. package/src/command/PermissionTagUpdateCommand.ts +64 -64
  57. package/src/command/PermissionUpdateCommand.ts +100 -100
  58. package/src/command/PolicyCategoryCommand.ts +37 -37
  59. package/src/command/PolicyCategoryCreateCommand.ts +55 -55
  60. package/src/command/PolicyCategoryDeleteCommand.ts +44 -44
  61. package/src/command/PolicyCategoryGetCommand.ts +44 -44
  62. package/src/command/PolicyCategoryListCommand.ts +44 -44
  63. package/src/command/PolicyCommand.ts +43 -43
  64. package/src/command/PolicyCreateCommand.ts +136 -136
  65. package/src/command/PolicyDeleteCommand.ts +44 -44
  66. package/src/command/PolicyFieldCommand.ts +39 -39
  67. package/src/command/PolicyFieldCreateCommand.ts +64 -64
  68. package/src/command/PolicyFieldDeleteCommand.ts +44 -44
  69. package/src/command/PolicyFieldGetCommand.ts +44 -44
  70. package/src/command/PolicyFieldListCommand.ts +44 -44
  71. package/src/command/PolicyFieldUpdateCommand.ts +64 -64
  72. package/src/command/PolicyGetCommand.ts +44 -44
  73. package/src/command/PolicyGetIncomingCommand.ts +44 -44
  74. package/src/command/PolicyListCommand.ts +44 -44
  75. package/src/command/PolicyListIncomingCommand.ts +44 -44
  76. package/src/command/PolicyTagCommand.ts +39 -39
  77. package/src/command/PolicyTagCreateCommand.ts +64 -64
  78. package/src/command/PolicyTagDeleteCommand.ts +44 -44
  79. package/src/command/PolicyTagGetCommand.ts +44 -44
  80. package/src/command/PolicyTagListCommand.ts +44 -44
  81. package/src/command/PolicyTagUpdateCommand.ts +64 -64
  82. package/src/command/PolicyUpdateCommand.ts +136 -136
  83. package/src/command/ProductCommand.ts +35 -35
  84. package/src/command/ProductGetCommand.ts +44 -44
  85. package/src/command/ProductListCommand.ts +44 -44
  86. package/src/command/Product_SetCommand.ts +55 -55
  87. package/src/command/RoleCategoryCommand.ts +37 -37
  88. package/src/command/RoleCategoryCreateCommand.ts +55 -55
  89. package/src/command/RoleCategoryDeleteCommand.ts +44 -44
  90. package/src/command/RoleCategoryGetCommand.ts +44 -44
  91. package/src/command/RoleCategoryListCommand.ts +44 -44
  92. package/src/command/RoleCommand.ts +43 -43
  93. package/src/command/RoleCreateCommand.ts +100 -100
  94. package/src/command/RoleDeleteCommand.ts +44 -44
  95. package/src/command/RoleFieldCommand.ts +39 -39
  96. package/src/command/RoleFieldCreateCommand.ts +64 -64
  97. package/src/command/RoleFieldDeleteCommand.ts +44 -44
  98. package/src/command/RoleFieldGetCommand.ts +44 -44
  99. package/src/command/RoleFieldListCommand.ts +44 -44
  100. package/src/command/RoleFieldUpdateCommand.ts +64 -64
  101. package/src/command/RoleGetCommand.ts +44 -44
  102. package/src/command/RoleGetIncomingCommand.ts +44 -44
  103. package/src/command/RoleListCommand.ts +44 -44
  104. package/src/command/RoleListIncomingCommand.ts +44 -44
  105. package/src/command/RoleTagCommand.ts +39 -39
  106. package/src/command/RoleTagCreateCommand.ts +64 -64
  107. package/src/command/RoleTagDeleteCommand.ts +44 -44
  108. package/src/command/RoleTagGetCommand.ts +44 -44
  109. package/src/command/RoleTagListCommand.ts +44 -44
  110. package/src/command/RoleTagUpdateCommand.ts +64 -64
  111. package/src/command/RoleUpdateCommand.ts +100 -100
  112. package/src/command/UserRoleCommand.ts +31 -31
  113. package/src/command/UserRole_SetCommand.ts +64 -64
  114. package/src/command/ValueCommand.ts +31 -31
  115. package/src/command/ValueListCommand.ts +44 -44
  116. package/src/command/cli.ts +64 -64
  117. package/src/index.ts +166 -166
  118. package/src/meta/NamirasoftAccessMetaDatabase.ts +83 -83
  119. package/src/meta/PermissionCategoryMetaTable.ts +57 -57
  120. package/src/meta/PermissionFieldMetaTable.ts +59 -59
  121. package/src/meta/PermissionMetaTable.ts +67 -67
  122. package/src/meta/PermissionTagMetaTable.ts +59 -59
  123. package/src/meta/PolicyCategoryMetaTable.ts +57 -57
  124. package/src/meta/PolicyFieldMetaTable.ts +59 -59
  125. package/src/meta/PolicyMetaTable.ts +67 -67
  126. package/src/meta/PolicyTagMetaTable.ts +59 -59
  127. package/src/meta/RoleCategoryMetaTable.ts +57 -57
  128. package/src/meta/RoleFieldMetaTable.ts +59 -59
  129. package/src/meta/RoleMetaTable.ts +57 -57
  130. package/src/meta/RoleTagMetaTable.ts +59 -59
  131. package/src/row/AccessRow.ts +27 -27
  132. package/src/row/EntityCategoryInputRow.ts +23 -23
  133. package/src/row/EntityFieldInputRow.ts +24 -24
  134. package/src/row/EntityTagInputRow.ts +24 -24
  135. package/src/row/PermissionCategoryRow.ts +28 -28
  136. package/src/row/PermissionFieldRow.ts +29 -29
  137. package/src/row/PermissionFullRow.ts +42 -42
  138. package/src/row/PermissionInputRow.ts +32 -32
  139. package/src/row/PermissionRow.ts +33 -33
  140. package/src/row/PermissionTagRow.ts +29 -29
  141. package/src/row/PolicyCategoryRow.ts +28 -28
  142. package/src/row/PolicyFieldRow.ts +29 -29
  143. package/src/row/PolicyFullRow.ts +40 -40
  144. package/src/row/PolicyInputRow.ts +36 -36
  145. package/src/row/PolicyRow.ts +33 -33
  146. package/src/row/PolicyTagRow.ts +29 -29
  147. package/src/row/ProductRow.ts +27 -27
  148. package/src/row/RoleCategoryRow.ts +28 -28
  149. package/src/row/RoleFieldRow.ts +29 -29
  150. package/src/row/RoleFullRow.ts +36 -36
  151. package/src/row/RoleInputRow.ts +32 -32
  152. package/src/row/RoleRow.ts +28 -28
  153. package/src/row/RoleTagRow.ts +29 -29
@@ -57,6 +57,9 @@ class AccessControl {
57
57
  }
58
58
  static check(policies, product_id, entity, action, id) {
59
59
  if (!AccessControl.isValid(policies, product_id, entity, action, id)) {
60
+ console.log({
61
+ policies, product_id, entity, action, id
62
+ });
60
63
  let message = `Access denied (Entity: '${entity}', Action: '${action}')`;
61
64
  if (id)
62
65
  message += ` on resource: ${id}`;
@@ -1 +1 @@
1
- {"version":3,"file":"AccessControl.js","sourceRoot":"","sources":["../src/AccessControl.ts"],"names":[],"mappings":";;;AAAA,qDAAmE;AAGnE,MAAa,aAAa;IAEtB,MAAM,CAAC,cAAc,CAAC,GAAsB;QAExC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ;YACzB,OAAO,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;IACD,MAAM,CAAC,aAAa,CAAC,QAA2B;QAE5C,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,QAAQ;YAC9B,OAAO,QAAQ,C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AC,EAAE,EACxC,CAAC;YACG,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC3B,IAAI,aAAa,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC;gBAC7D,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;oBAClD,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC;wBACnD,IAAI,aAAa,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;4BACnD,OAAO,MAAM,CAAC,KAAK,CAAC;QACxC,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,QAAqB,EAAE,UAAkB,EAAE,MAAc,EAAE,MAAc,EAAE,EAAiB;QAErG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EACpE,CAAC;YACG,OAAO,CAAC,GAAG,CAAC;gBACR,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;aAC3C,CAAC,CAAA;YACF,IAAI,OAAO,GAAG,2BAA2B,MAAM,eAAe,MAAM,IAAI,CAAC;YACzE,IAAI,EAAE;gBACF,OAAO,IAAI,iBAAiB,EAAE,EAAE,CAAC;YACrC,MAAM,gCAAc,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;IACL,CAAC;CACJ;AAhFD,sCAgFC"}
@@ -21,7 +21,7 @@ const NamirasoftAccessServerUserRole_1 = require("./NamirasoftAccessServerUserRo
21
21
  const NamirasoftAccessServerValue_1 = require("./NamirasoftAccessServerValue");
22
22
  class NamirasoftAccessServer extends namirasoft_account_1.NSABaseServer {
23
23
  constructor(base_url, manager, onError) {
24
- super(base_url, `1.4.62`, manager, onError);
24
+ super(base_url, `1.4.63`, manager, onError);
25
25
  this.healthz = new NamirasoftAccessServerHealthz_1.NamirasoftAccessServerHealthz(this);
26
26
  this.value = new NamirasoftAccessServerValue_1.NamirasoftAccessServerValue(this);
27
27
  this.permission_category = new NamirasoftAccessServerPermissionCategory_1.NamirasoftAccessServerPermissionCategory(this);
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "namirasoft-access",
3
- "title": "Namirasoft Access NPM Package",
4
- "description": "Namira Software Corporation Access NPM Package",
5
- "icon": "logo.png",
6
- "logo": "https://static.namirasoft.com/image/namirasoft/access/logo/base.png",
7
- "language": "ts",
8
- "framework": "npm",
9
- "application": "package",
10
- "private": false,
11
- "version": "1.4.63",
12
- "author": "Amir Abolhasani",
13
- "license": "MIT",
14
- "main": "./dist/index.js",
15
- "types": "./dist/index.d.ts",
16
- "scripts": {
17
- "build": ""
18
- },
19
- "dependencies": {
20
- "namirasoft-core": "^1.4.62",
21
- "namirasoft-site": "^1.4.24",
22
- "namirasoft-node-cli": "^1.4.5",
23
- "namirasoft-account": "^1.4.69"
24
- },
25
- "bin": {
26
- "ns-access": "./dist/command/cli.js"
27
- }
1
+ {
2
+ "name": "namirasoft-access",
3
+ "title": "Namirasoft Access NPM Package",
4
+ "description": "Namira Software Corporation Access NPM Package",
5
+ "icon": "logo.png",
6
+ "logo": "https://static.namirasoft.com/image/namirasoft/access/logo/base.png",
7
+ "language": "ts",
8
+ "framework": "npm",
9
+ "application": "package",
10
+ "private": false,
11
+ "version": "1.4.64",
12
+ "author": "Amir Abolhasani",
13
+ "license": "MIT",
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "scripts": {
17
+ "build": ""
18
+ },
19
+ "dependencies": {
20
+ "namirasoft-core": "^1.4.62",
21
+ "namirasoft-site": "^1.4.24",
22
+ "namirasoft-node-cli": "^1.4.5",
23
+ "namirasoft-account": "^1.4.69"
24
+ },
25
+ "bin": {
26
+ "ns-access": "./dist/command/cli.js"
27
+ }
28
28
  }
@@ -1,81 +1,84 @@
1
- import { ErrorOperation, NamingConvention } from "namirasoft-core";
2
- import { PolicyRow } from "./row/PolicyRow";
3
-
4
- export class AccessControl
5
- {
6
- static splitResources(ids: string[] | string): string[]
7
- {
8
- if (typeof (ids) === "string")
9
- return ids.split(/[\s;,|]+/).map(e => AccessControl.formatResource(e));
10
- return ids.map(e => AccessControl.formatResource(e));
11
- }
12
- static splitEntities(enitties: string[] | string): string[]
13
- {
14
- if (typeof (enitties) === "string")
15
- return enitties.split(/[\s;,|]+/).map(e => AccessControl.formatEntity(e));
16
- return enitties.map(e => AccessControl.formatEntity(e));
17
- }
18
- static splitActions(actions: string[] | string): string[]
19
- {
20
- if (typeof (actions) === "string")
21
- return actions.split(/[\s;,|]+/).map(e => AccessControl.formatAction(e));
22
- return actions.map(e => AccessControl.formatAction(e));
23
- }
24
- static formatResource(resource: string): string
25
- {
26
- return NamingConvention.auto.convert(resource, NamingConvention.lower_case_dash).trim();
27
- }
28
- static formatEntity(entity: string): string
29
- {
30
- return NamingConvention.auto.convert(entity, NamingConvention.Pascal_Case).trim();
31
- }
32
- static formatAction(action: | string): string
33
- {
34
- return NamingConvention.auto.convert(action, NamingConvention.Pascal_Case).trim();
35
- }
36
- static isApplicationAction(action: string): boolean
37
- {
38
- return action.startsWith("_");
39
- }
40
- static isValidProductID(policy_product_id: string, product_id: string): boolean
41
- {
42
- return (policy_product_id == "*" || policy_product_id === product_id)
43
- }
44
- static isValidEntity(policy_entity: string[] | string, entity: string): boolean
45
- {
46
- return policy_entity == "*" || AccessControl.splitEntities(policy_entity).includes(entity);
47
- }
48
- static isValidAction(policy_actions: string[] | string, action: string): boolean
49
- {
50
- return (policy_actions == "*" && !AccessControl.isApplicationAction(action)) || AccessControl.splitActions(policy_actions).includes(action);
51
- }
52
- static isValidResource(policy_resources: string[] | string, id: string | null): boolean
53
- {
54
- return policy_resources == "*" || id === null || AccessControl.splitResources(policy_resources).includes(id);
55
- }
56
- static isValid(policies: PolicyRow[], product_id: string, entity: string, action: string, id: string | null): boolean
57
- {
58
- entity = NamingConvention.auto.convert(entity, NamingConvention.lower_case_underscore).trim();
59
- action = NamingConvention.auto.convert(action, NamingConvention.lower_case_underscore).trim();
60
- for (let i = 0; i < policies.length; i++)
61
- {
62
- const policy = policies[i];
63
- if (AccessControl.isValidProductID(policy.product_id, product_id))
64
- if (AccessControl.isValidEntity(policy.entity, entity))
65
- if (AccessControl.isValidAction(policy.actions, action))
66
- if (AccessControl.isValidResource(policy.resources, id))
67
- return policy.allow;
68
- }
69
- return false;
70
- }
71
- static check(policies: PolicyRow[], product_id: string, entity: string, action: string, id: string | null): void
72
- {
73
- if (!AccessControl.isValid(policies, product_id, entity, action, id))
74
- {
75
- let message = `Access denied (Entity: '${entity}', Action: '${action}')`;
76
- if (id)
77
- message += ` on resource: ${id}`;
78
- throw ErrorOperation.getHTTP(403, message);
79
- }
80
- }
1
+ import { ErrorOperation, NamingConvention } from "namirasoft-core";
2
+ import { PolicyRow } from "./row/PolicyRow";
3
+
4
+ export class AccessControl
5
+ {
6
+ static splitResources(ids: string[] | string): string[]
7
+ {
8
+ if (typeof (ids) === "string")
9
+ return ids.split(/[\s;,|]+/).map(e => AccessControl.formatResource(e));
10
+ return ids.map(e => AccessControl.formatResource(e));
11
+ }
12
+ static splitEntities(enitties: string[] | string): string[]
13
+ {
14
+ if (typeof (enitties) === "string")
15
+ return enitties.split(/[\s;,|]+/).map(e => AccessControl.formatEntity(e));
16
+ return enitties.map(e => AccessControl.formatEntity(e));
17
+ }
18
+ static splitActions(actions: string[] | string): string[]
19
+ {
20
+ if (typeof (actions) === "string")
21
+ return actions.split(/[\s;,|]+/).map(e => AccessControl.formatAction(e));
22
+ return actions.map(e => AccessControl.formatAction(e));
23
+ }
24
+ static formatResource(resource: string): string
25
+ {
26
+ return NamingConvention.auto.convert(resource, NamingConvention.lower_case_dash).trim();
27
+ }
28
+ static formatEntity(entity: string): string
29
+ {
30
+ return NamingConvention.auto.convert(entity, NamingConvention.Pascal_Case).trim();
31
+ }
32
+ static formatAction(action: | string): string
33
+ {
34
+ return NamingConvention.auto.convert(action, NamingConvention.Pascal_Case).trim();
35
+ }
36
+ static isApplicationAction(action: string): boolean
37
+ {
38
+ return action.startsWith("_");
39
+ }
40
+ static isValidProductID(policy_product_id: string, product_id: string): boolean
41
+ {
42
+ return (policy_product_id == "*" || policy_product_id === product_id)
43
+ }
44
+ static isValidEntity(policy_entity: string[] | string, entity: string): boolean
45
+ {
46
+ return policy_entity == "*" || AccessControl.splitEntities(policy_entity).includes(entity);
47
+ }
48
+ static isValidAction(policy_actions: string[] | string, action: string): boolean
49
+ {
50
+ return (policy_actions == "*" && !AccessControl.isApplicationAction(action)) || AccessControl.splitActions(policy_actions).includes(action);
51
+ }
52
+ static isValidResource(policy_resources: string[] | string, id: string | null): boolean
53
+ {
54
+ return policy_resources == "*" || id === null || AccessControl.splitResources(policy_resources).includes(id);
55
+ }
56
+ static isValid(policies: PolicyRow[], product_id: string, entity: string, action: string, id: string | null): boolean
57
+ {
58
+ entity = NamingConvention.auto.convert(entity, NamingConvention.lower_case_underscore).trim();
59
+ action = NamingConvention.auto.convert(action, NamingConvention.lower_case_underscore).trim();
60
+ for (let i = 0; i < policies.length; i++)
61
+ {
62
+ const policy = policies[i];
63
+ if (AccessControl.isValidProductID(policy.product_id, product_id))
64
+ if (AccessControl.isValidEntity(policy.entity, entity))
65
+ if (AccessControl.isValidAction(policy.actions, action))
66
+ if (AccessControl.isValidResource(policy.resources, id))
67
+ return policy.allow;
68
+ }
69
+ return false;
70
+ }
71
+ static check(policies: PolicyRow[], product_id: string, entity: string, action: string, id: string | null): void
72
+ {
73
+ if (!AccessControl.isValid(policies, product_id, entity, action, id))
74
+ {
75
+ console.log({
76
+ policies, product_id, entity, action, id
77
+ })
78
+ let message = `Access denied (Entity: '${entity}', Action: '${action}')`;
79
+ if (id)
80
+ message += ` on resource: ${id}`;
81
+ throw ErrorOperation.getHTTP(403, message);
82
+ }
83
+ }
81
84
  }
@@ -1,81 +1,81 @@
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 change is required, ns-sdkg command must be used */
12
- /* */
13
- /****************************************************************/
14
- /****************************************************************/
15
- /* */
16
- /* Namira Software Corporation */
17
- /* https://namirasoft.com */
18
- /* */
19
- /****************************************************************/
20
-
21
- import { NSABaseServer } from "namirasoft-account";
22
- import { NamirasoftAccessServerAccess } from "./NamirasoftAccessServerAccess";
23
- import { NamirasoftAccessServerHealthz } from "./NamirasoftAccessServerHealthz";
24
- import { NamirasoftAccessServerPermission } from "./NamirasoftAccessServerPermission";
25
- import { NamirasoftAccessServerPermissionCategory } from "./NamirasoftAccessServerPermissionCategory";
26
- import { NamirasoftAccessServerPermissionField } from "./NamirasoftAccessServerPermissionField";
27
- import { NamirasoftAccessServerPermissionTag } from "./NamirasoftAccessServerPermissionTag";
28
- import { NamirasoftAccessServerPolicy } from "./NamirasoftAccessServerPolicy";
29
- import { NamirasoftAccessServerPolicyCategory } from "./NamirasoftAccessServerPolicyCategory";
30
- import { NamirasoftAccessServerPolicyField } from "./NamirasoftAccessServerPolicyField";
31
- import { NamirasoftAccessServerPolicyTag } from "./NamirasoftAccessServerPolicyTag";
32
- import { NamirasoftAccessServerProduct } from "./NamirasoftAccessServerProduct";
33
- import { NamirasoftAccessServerRole } from "./NamirasoftAccessServerRole";
34
- import { NamirasoftAccessServerRoleCategory } from "./NamirasoftAccessServerRoleCategory";
35
- import { NamirasoftAccessServerRoleField } from "./NamirasoftAccessServerRoleField";
36
- import { NamirasoftAccessServerRoleTag } from "./NamirasoftAccessServerRoleTag";
37
- import { NamirasoftAccessServerUserRole } from "./NamirasoftAccessServerUserRole";
38
- import { NamirasoftAccessServerValue } from "./NamirasoftAccessServerValue";
39
- import { TokenManager } from "namirasoft-account";
40
-
41
- export class NamirasoftAccessServer extends NSABaseServer
42
- {
43
- healthz: NamirasoftAccessServerHealthz;
44
- value: NamirasoftAccessServerValue;
45
- permission_category: NamirasoftAccessServerPermissionCategory;
46
- permission_field: NamirasoftAccessServerPermissionField;
47
- permission_tag: NamirasoftAccessServerPermissionTag;
48
- permission: NamirasoftAccessServerPermission;
49
- policy_category: NamirasoftAccessServerPolicyCategory;
50
- policy_field: NamirasoftAccessServerPolicyField;
51
- policy_tag: NamirasoftAccessServerPolicyTag;
52
- policy: NamirasoftAccessServerPolicy;
53
- role_category: NamirasoftAccessServerRoleCategory;
54
- role_field: NamirasoftAccessServerRoleField;
55
- role_tag: NamirasoftAccessServerRoleTag;
56
- role: NamirasoftAccessServerRole;
57
- access: NamirasoftAccessServerAccess;
58
- product: NamirasoftAccessServerProduct;
59
- user_role: NamirasoftAccessServerUserRole;
60
- constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void)
61
- {
62
- super(base_url, `1.4.62`, manager, onError);
63
- this.healthz = new NamirasoftAccessServerHealthz(this);
64
- this.value = new NamirasoftAccessServerValue(this);
65
- this.permission_category = new NamirasoftAccessServerPermissionCategory(this);
66
- this.permission_field = new NamirasoftAccessServerPermissionField(this);
67
- this.permission_tag = new NamirasoftAccessServerPermissionTag(this);
68
- this.permission = new NamirasoftAccessServerPermission(this);
69
- this.policy_category = new NamirasoftAccessServerPolicyCategory(this);
70
- this.policy_field = new NamirasoftAccessServerPolicyField(this);
71
- this.policy_tag = new NamirasoftAccessServerPolicyTag(this);
72
- this.policy = new NamirasoftAccessServerPolicy(this);
73
- this.role_category = new NamirasoftAccessServerRoleCategory(this);
74
- this.role_field = new NamirasoftAccessServerRoleField(this);
75
- this.role_tag = new NamirasoftAccessServerRoleTag(this);
76
- this.role = new NamirasoftAccessServerRole(this);
77
- this.access = new NamirasoftAccessServerAccess(this);
78
- this.product = new NamirasoftAccessServerProduct(this);
79
- this.user_role = new NamirasoftAccessServerUserRole(this);
80
- }
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 change is required, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ import { NSABaseServer } from "namirasoft-account";
22
+ import { NamirasoftAccessServerAccess } from "./NamirasoftAccessServerAccess";
23
+ import { NamirasoftAccessServerHealthz } from "./NamirasoftAccessServerHealthz";
24
+ import { NamirasoftAccessServerPermission } from "./NamirasoftAccessServerPermission";
25
+ import { NamirasoftAccessServerPermissionCategory } from "./NamirasoftAccessServerPermissionCategory";
26
+ import { NamirasoftAccessServerPermissionField } from "./NamirasoftAccessServerPermissionField";
27
+ import { NamirasoftAccessServerPermissionTag } from "./NamirasoftAccessServerPermissionTag";
28
+ import { NamirasoftAccessServerPolicy } from "./NamirasoftAccessServerPolicy";
29
+ import { NamirasoftAccessServerPolicyCategory } from "./NamirasoftAccessServerPolicyCategory";
30
+ import { NamirasoftAccessServerPolicyField } from "./NamirasoftAccessServerPolicyField";
31
+ import { NamirasoftAccessServerPolicyTag } from "./NamirasoftAccessServerPolicyTag";
32
+ import { NamirasoftAccessServerProduct } from "./NamirasoftAccessServerProduct";
33
+ import { NamirasoftAccessServerRole } from "./NamirasoftAccessServerRole";
34
+ import { NamirasoftAccessServerRoleCategory } from "./NamirasoftAccessServerRoleCategory";
35
+ import { NamirasoftAccessServerRoleField } from "./NamirasoftAccessServerRoleField";
36
+ import { NamirasoftAccessServerRoleTag } from "./NamirasoftAccessServerRoleTag";
37
+ import { NamirasoftAccessServerUserRole } from "./NamirasoftAccessServerUserRole";
38
+ import { NamirasoftAccessServerValue } from "./NamirasoftAccessServerValue";
39
+ import { TokenManager } from "namirasoft-account";
40
+
41
+ export class NamirasoftAccessServer extends NSABaseServer
42
+ {
43
+ healthz: NamirasoftAccessServerHealthz;
44
+ value: NamirasoftAccessServerValue;
45
+ permission_category: NamirasoftAccessServerPermissionCategory;
46
+ permission_field: NamirasoftAccessServerPermissionField;
47
+ permission_tag: NamirasoftAccessServerPermissionTag;
48
+ permission: NamirasoftAccessServerPermission;
49
+ policy_category: NamirasoftAccessServerPolicyCategory;
50
+ policy_field: NamirasoftAccessServerPolicyField;
51
+ policy_tag: NamirasoftAccessServerPolicyTag;
52
+ policy: NamirasoftAccessServerPolicy;
53
+ role_category: NamirasoftAccessServerRoleCategory;
54
+ role_field: NamirasoftAccessServerRoleField;
55
+ role_tag: NamirasoftAccessServerRoleTag;
56
+ role: NamirasoftAccessServerRole;
57
+ access: NamirasoftAccessServerAccess;
58
+ product: NamirasoftAccessServerProduct;
59
+ user_role: NamirasoftAccessServerUserRole;
60
+ constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void)
61
+ {
62
+ super(base_url, `1.4.63`, manager, onError);
63
+ this.healthz = new NamirasoftAccessServerHealthz(this);
64
+ this.value = new NamirasoftAccessServerValue(this);
65
+ this.permission_category = new NamirasoftAccessServerPermissionCategory(this);
66
+ this.permission_field = new NamirasoftAccessServerPermissionField(this);
67
+ this.permission_tag = new NamirasoftAccessServerPermissionTag(this);
68
+ this.permission = new NamirasoftAccessServerPermission(this);
69
+ this.policy_category = new NamirasoftAccessServerPolicyCategory(this);
70
+ this.policy_field = new NamirasoftAccessServerPolicyField(this);
71
+ this.policy_tag = new NamirasoftAccessServerPolicyTag(this);
72
+ this.policy = new NamirasoftAccessServerPolicy(this);
73
+ this.role_category = new NamirasoftAccessServerRoleCategory(this);
74
+ this.role_field = new NamirasoftAccessServerRoleField(this);
75
+ this.role_tag = new NamirasoftAccessServerRoleTag(this);
76
+ this.role = new NamirasoftAccessServerRole(this);
77
+ this.access = new NamirasoftAccessServerAccess(this);
78
+ this.product = new NamirasoftAccessServerProduct(this);
79
+ this.user_role = new NamirasoftAccessServerUserRole(this);
80
+ }
81
81
  };
@@ -1,44 +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 change is required, ns-sdkg command must be used */
12
- /* */
13
- /****************************************************************/
14
- /****************************************************************/
15
- /* */
16
- /* Namira Software Corporation */
17
- /* https://namirasoft.com */
18
- /* */
19
- /****************************************************************/
20
-
21
- import { AccessRow } from "./row/AccessRow";
22
- import { NamirasoftAccessServer } from "./NamirasoftAccessServer";
23
- import { NamirasoftAccessServerBase } from "./NamirasoftAccessServerBase";
24
-
25
- export class NamirasoftAccessServerAccess extends NamirasoftAccessServerBase
26
- {
27
- constructor(server: NamirasoftAccessServer)
28
- {
29
- super(server);
30
- this._GetFor = this._GetFor.bind(this);
31
- this.SetOwner = this.SetOwner.bind(this);
32
- }
33
- async _GetFor(user_id: string, owner_id: (string | null)): Promise<AccessRow>
34
- {
35
- let path = `/application/access/${user_id}/${owner_id}`;
36
- let { data } = await this.server._get<AccessRow>(path, {});
37
- return data;
38
- }
39
- async SetOwner(body: { owner_id: (string | null) }): Promise<void>
40
- {
41
- let path = `/access/owner`;
42
- await this.server._put<void>(path, {}, body);
43
- }
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 change is required, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ import { AccessRow } from "./row/AccessRow";
22
+ import { NamirasoftAccessServer } from "./NamirasoftAccessServer";
23
+ import { NamirasoftAccessServerBase } from "./NamirasoftAccessServerBase";
24
+
25
+ export class NamirasoftAccessServerAccess extends NamirasoftAccessServerBase
26
+ {
27
+ constructor(server: NamirasoftAccessServer)
28
+ {
29
+ super(server);
30
+ this._GetFor = this._GetFor.bind(this);
31
+ this.SetOwner = this.SetOwner.bind(this);
32
+ }
33
+ async _GetFor(user_id: string, owner_id: (string | null)): Promise<AccessRow>
34
+ {
35
+ let path = `/application/access/${user_id}/${owner_id}`;
36
+ let { data } = await this.server._get<AccessRow>(path, {});
37
+ return data;
38
+ }
39
+ async SetOwner(body: { owner_id: (string | null) }): Promise<void>
40
+ {
41
+ let path = `/access/owner`;
42
+ await this.server._put<void>(path, {}, body);
43
+ }
44
44
  };
@@ -1,30 +1,30 @@
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 change is required, ns-sdkg command must be used */
12
- /* */
13
- /****************************************************************/
14
- /****************************************************************/
15
- /* */
16
- /* Namira Software Corporation */
17
- /* https://namirasoft.com */
18
- /* */
19
- /****************************************************************/
20
-
21
- import { NamirasoftAccessServer } from "./NamirasoftAccessServer";
22
-
23
- export class NamirasoftAccessServerBase
24
- {
25
- public server: NamirasoftAccessServer;
26
- constructor(server: NamirasoftAccessServer)
27
- {
28
- this.server = server;
29
- }
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 change is required, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ import { NamirasoftAccessServer } from "./NamirasoftAccessServer";
22
+
23
+ export class NamirasoftAccessServerBase
24
+ {
25
+ public server: NamirasoftAccessServer;
26
+ constructor(server: NamirasoftAccessServer)
27
+ {
28
+ this.server = server;
29
+ }
30
30
  };