@codiac.io/codiac-cli 1.2.264 → 1.3.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.
Files changed (116) hide show
  1. package/README.md +1 -1
  2. package/dist/apis/codiac-api/common/api-client-base.d.ts +21 -7
  3. package/dist/apis/codiac-api/common/api-client-base.js +8 -6
  4. package/dist/apis/codiac-api/common/api-client-base.js.map +1 -1
  5. package/dist/apis/codiac-api/gen/client.d.ts +268 -198
  6. package/dist/apis/codiac-api/gen/client.js +2464 -970
  7. package/dist/apis/codiac-api/gen/client.js.map +1 -1
  8. package/dist/apis/codiac-api/gen/contracts.d.ts +171 -33
  9. package/dist/apis/codiac-api/gen/contracts.js +72 -76
  10. package/dist/apis/codiac-api/gen/contracts.js.map +1 -1
  11. package/dist/apis/codiac-relay/gen/client.d.ts +2 -2
  12. package/dist/apis/codiac-relay/gen/client.js.map +1 -1
  13. package/dist/cli-common/command-base.d.ts +10 -0
  14. package/dist/cli-common/command-base.js +21 -0
  15. package/dist/cli-common/command-base.js.map +1 -1
  16. package/dist/command-base-enterprise.d.ts +11 -11
  17. package/dist/command-base-enterprise.js +83 -60
  18. package/dist/command-base-enterprise.js.map +1 -1
  19. package/dist/command-base-exec-tenant.d.ts +21 -0
  20. package/dist/command-base-exec-tenant.js +72 -0
  21. package/dist/command-base-exec-tenant.js.map +1 -0
  22. package/dist/command-base-tenantless.d.ts +0 -5
  23. package/dist/command-base-tenantless.js +0 -11
  24. package/dist/command-base-tenantless.js.map +1 -1
  25. package/dist/commands/asset/deploy.js +1 -0
  26. package/dist/commands/asset/deploy.js.map +1 -1
  27. package/dist/commands/auth/cabinet/allow.d.ts +49 -0
  28. package/dist/commands/auth/cabinet/allow.js +155 -0
  29. package/dist/commands/auth/cabinet/allow.js.map +1 -0
  30. package/dist/commands/auth/cabinet/allowed.d.ts +44 -0
  31. package/dist/commands/auth/cabinet/allowed.js +187 -0
  32. package/dist/commands/auth/cabinet/allowed.js.map +1 -0
  33. package/dist/commands/auth/enterprise/allow/onEnvironments.d.ts +41 -0
  34. package/dist/commands/auth/enterprise/allow/onEnvironments.js +146 -0
  35. package/dist/commands/auth/enterprise/allow/onEnvironments.js.map +1 -0
  36. package/dist/commands/auth/enterprise/allow.d.ts +43 -0
  37. package/dist/commands/auth/enterprise/allow.js +140 -0
  38. package/dist/commands/auth/enterprise/allow.js.map +1 -0
  39. package/dist/commands/auth/enterprise/allowed.d.ts +40 -0
  40. package/dist/commands/auth/enterprise/allowed.js +171 -0
  41. package/dist/commands/auth/enterprise/allowed.js.map +1 -0
  42. package/dist/commands/auth/environment/allow/onCabinets.d.ts +43 -0
  43. package/dist/commands/auth/environment/allow/onCabinets.js +156 -0
  44. package/dist/commands/auth/environment/allow/onCabinets.js.map +1 -0
  45. package/dist/commands/auth/environment/allow.d.ts +46 -0
  46. package/dist/commands/auth/environment/allow.js +148 -0
  47. package/dist/commands/auth/environment/allow.js.map +1 -0
  48. package/dist/commands/auth/environment/allowed.d.ts +42 -0
  49. package/dist/commands/auth/environment/allowed.js +182 -0
  50. package/dist/commands/auth/environment/allowed.js.map +1 -0
  51. package/dist/commands/auth/register.d.ts +32 -0
  52. package/dist/commands/auth/register.js +170 -0
  53. package/dist/commands/auth/register.js.map +1 -0
  54. package/dist/commands/auth/role/allowed.d.ts +33 -0
  55. package/dist/commands/auth/role/allowed.js +135 -0
  56. package/dist/commands/auth/role/allowed.js.map +1 -0
  57. package/dist/commands/auth/role/assign.d.ts +26 -0
  58. package/dist/commands/auth/role/assign.js +92 -0
  59. package/dist/commands/auth/role/assign.js.map +1 -0
  60. package/dist/commands/auth/role/create.d.ts +24 -0
  61. package/dist/commands/auth/role/create.js +90 -0
  62. package/dist/commands/auth/role/create.js.map +1 -0
  63. package/dist/commands/auth/role/delete.d.ts +28 -0
  64. package/dist/commands/auth/role/delete.js +119 -0
  65. package/dist/commands/auth/role/delete.js.map +1 -0
  66. package/dist/commands/auth/role/list.d.ts +26 -0
  67. package/dist/commands/auth/role/list.js +108 -0
  68. package/dist/commands/auth/role/list.js.map +1 -0
  69. package/dist/commands/auth/role/unassign.d.ts +26 -0
  70. package/dist/commands/auth/role/unassign.js +92 -0
  71. package/dist/commands/auth/role/unassign.js.map +1 -0
  72. package/dist/commands/auth/user/invite.d.ts +24 -0
  73. package/dist/commands/auth/user/invite.js +105 -0
  74. package/dist/commands/auth/user/invite.js.map +1 -0
  75. package/dist/commands/auth/user/list.d.ts +26 -0
  76. package/dist/commands/auth/user/list.js +118 -0
  77. package/dist/commands/auth/user/list.js.map +1 -0
  78. package/dist/commands/cabinet/create.d.ts +1 -1
  79. package/dist/commands/cabinet/create.js +28 -20
  80. package/dist/commands/cabinet/create.js.map +1 -1
  81. package/dist/commands/cabinet/list.d.ts +1 -0
  82. package/dist/commands/cabinet/list.js +9 -1
  83. package/dist/commands/cabinet/list.js.map +1 -1
  84. package/dist/commands/cabinet/obliterate.js +39 -34
  85. package/dist/commands/cabinet/obliterate.js.map +1 -1
  86. package/dist/commands/config/deploy.js +5 -2
  87. package/dist/commands/config/deploy.js.map +1 -1
  88. package/dist/commands/enterprise/create.js +1 -1
  89. package/dist/commands/enterprise/create.js.map +1 -1
  90. package/dist/commands/environment/create.d.ts +1 -0
  91. package/dist/commands/environment/create.js +4 -2
  92. package/dist/commands/environment/create.js.map +1 -1
  93. package/dist/commands/secretStore/list.js +2 -2
  94. package/dist/commands/secretStore/list.js.map +1 -1
  95. package/dist/commands/tenant/create.d.ts +0 -2
  96. package/dist/commands/tenant/create.js +0 -33
  97. package/dist/commands/tenant/create.js.map +1 -1
  98. package/dist/commands/tenant/switch.d.ts +0 -2
  99. package/dist/commands/tenant/switch.js +0 -33
  100. package/dist/commands/tenant/switch.js.map +1 -1
  101. package/dist/commands/whoami.d.ts +3 -1
  102. package/dist/commands/whoami.js +8 -2
  103. package/dist/commands/whoami.js.map +1 -1
  104. package/dist/ops/data/cli-context-repo.js +2 -2
  105. package/dist/ops/data/cli-context-repo.js.map +1 -1
  106. package/dist/relay/relay-container.js +1 -1
  107. package/dist/relay/relay-container.js.map +1 -1
  108. package/dist/uilogic/rootmap-ui-utils.js +38 -8
  109. package/dist/uilogic/rootmap-ui-utils.js.map +1 -1
  110. package/dist/uilogic/tenant-contextualizer.js +8 -2
  111. package/dist/uilogic/tenant-contextualizer.js.map +1 -1
  112. package/dist/user-context-loader.d.ts +1 -1
  113. package/dist/user-context-loader.js +3 -2
  114. package/dist/user-context-loader.js.map +1 -1
  115. package/oclif.manifest.json +1597 -93
  116. package/package.json +4 -4
@@ -0,0 +1,46 @@
1
+ import { AtLeast } from "@codiac.io/codiac-common/contracts";
2
+ import { InteractionModes } from '../../../uilogic/config-ui-utils';
3
+ import { Privilege, RootMap } from '../../../apis/codiac-api/contracts';
4
+ import { CommandBaseExec } from '../../../command-base-exec';
5
+ export declare enum PrivilegeAbbrevsEnum {
6
+ "modify" = "modify",
7
+ "read" = "read",
8
+ "none" = "none"
9
+ }
10
+ export interface IPermissionAssignment {
11
+ entityType: string;
12
+ entityKey: {
13
+ enterpriseCode: string;
14
+ code: string;
15
+ };
16
+ role: string;
17
+ privileges: Privilege[];
18
+ }
19
+ export type IPermission = {
20
+ enterprise: string;
21
+ environment: string;
22
+ role: string;
23
+ privilege: PrivilegeAbbrevsEnum;
24
+ } & IPermissionAssignment;
25
+ export default class AuthEnvironmentAllow extends CommandBaseExec<IPermission> {
26
+ static description: string;
27
+ static aliases: string[];
28
+ static examples: string[];
29
+ static flags: {
30
+ enterprise: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
31
+ environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
32
+ role: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
33
+ privilege: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
34
+ silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
35
+ echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
36
+ "to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
37
+ "take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
38
+ };
39
+ static args: {};
40
+ protected adminOnly: boolean;
41
+ captureArgs(enterpriseCode: string): Promise<[AtLeast<IPermission, "enterprise">, InteractionModes | undefined, boolean]>;
42
+ buildCandidate_silently(partial: AtLeast<IPermission, "enterprise">, rootMap: RootMap): Promise<IPermission | undefined>;
43
+ buildCandidate_interactively(partial: AtLeast<IPermission, "enterprise">, rootMap: RootMap, takeDefaults: boolean): Promise<IPermission | undefined>;
44
+ buildCommandString(candidate: IPermission, cmd: string[]): string[];
45
+ executeTask(candidate: IPermission): Promise<void>;
46
+ }
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrivilegeAbbrevsEnum = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@oclif/core");
6
+ const _ = require("lodash");
7
+ const config_ui_utils_1 = require("../../../uilogic/config-ui-utils");
8
+ const contracts_1 = require("../../../apis/codiac-api/contracts");
9
+ const command_base_exec_1 = require("../../../command-base-exec");
10
+ var PrivilegeAbbrevsEnum;
11
+ (function (PrivilegeAbbrevsEnum) {
12
+ PrivilegeAbbrevsEnum["modify"] = "modify";
13
+ PrivilegeAbbrevsEnum["read"] = "read";
14
+ PrivilegeAbbrevsEnum["none"] = "none";
15
+ })(PrivilegeAbbrevsEnum = exports.PrivilegeAbbrevsEnum || (exports.PrivilegeAbbrevsEnum = {}));
16
+ class AuthEnvironmentAllow extends command_base_exec_1.CommandBaseExec {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.adminOnly = true;
20
+ }
21
+ captureArgs(enterpriseCode) {
22
+ var _a, _b;
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const { args, flags } = yield this.parse(AuthEnvironmentAllow);
25
+ let partial = {
26
+ enterprise: enterpriseCode
27
+ };
28
+ if (flags.enterprise)
29
+ partial.enterprise = flags.enterprise;
30
+ if (flags.environment)
31
+ partial.environment = flags.environment;
32
+ if (flags.role)
33
+ partial.role = flags.role;
34
+ if (flags.privilege) {
35
+ partial.privilege = PrivilegeAbbrevsEnum[flags.privilege];
36
+ switch (flags.privilege) {
37
+ case PrivilegeAbbrevsEnum.modify:
38
+ partial.privileges = [contracts_1.Privilege.Create, contracts_1.Privilege.Read, contracts_1.Privilege.Update, contracts_1.Privilege.Delete];
39
+ break;
40
+ case PrivilegeAbbrevsEnum.read:
41
+ partial.privileges = [contracts_1.Privilege.Read];
42
+ break;
43
+ case PrivilegeAbbrevsEnum.none:
44
+ default:
45
+ partial.privileges = [];
46
+ break;
47
+ }
48
+ }
49
+ // ---------------------------------------------------------------
50
+ // TODO: move everything from here down into the base class
51
+ // ---------------------------------------------------------------
52
+ const interactionMode = (this.pipedInput) ? config_ui_utils_1.InteractionModes.silent : (_b = (_a = undefined !== null && undefined !== void 0 ? undefined : (flags.echo ? config_ui_utils_1.InteractionModes.echo : undefined)) !== null && _a !== void 0 ? _a : (flags["to-script"] ? config_ui_utils_1.InteractionModes.toscript : undefined)) !== null && _b !== void 0 ? _b : (flags.silent ? config_ui_utils_1.InteractionModes.silent : undefined);
53
+ const takeDefaults = flags['take-defaults'];
54
+ return [partial, interactionMode, takeDefaults];
55
+ });
56
+ }
57
+ // /** Throws on invalid */
58
+ // private validate(partial: Partial<IAuthRoleDef>): void {
59
+ // if (partial.name == undefined || _.isEmpty(partial.name)) throw new Error("Missing name");
60
+ // let rxName = /^[a-zA-Z][a-zA-Z0-9-]{2,50}$/;
61
+ // if (!rxName.test(partial.name)) throw new Error("Invalid name: must be 3- to 50-character string of alphanumerics and hyphens, starting with a letter.");
62
+ // }
63
+ buildCandidate_silently(partial, rootMap) {
64
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
65
+ if (partial.enterprise == undefined || _.isEmpty(partial.enterprise))
66
+ throw new Error("Must specify enterprise.");
67
+ if (partial.environment == undefined || _.isEmpty(partial.environment))
68
+ throw new Error("Must specify environment.");
69
+ if (partial.role == undefined || _.isEmpty(partial.role))
70
+ throw new Error("Must specify role.");
71
+ if (partial.privilege == undefined || _.isEmpty(partial.privilege))
72
+ throw new Error("Must specify privilege.");
73
+ if (partial.privileges == undefined)
74
+ throw new Error("Must specify privileges.");
75
+ let candidate = {
76
+ /* cmd arg */ enterprise: partial.enterprise,
77
+ /* cmd arg */ environment: partial.environment,
78
+ /* cmd arg */ privilege: partial.privilege,
79
+ role: partial.role,
80
+ /* api syntax */ privileges: partial.privileges,
81
+ /* api syntax */ entityType: "Environment",
82
+ /* api syntax */ entityKey: { enterpriseCode: partial.enterprise, code: partial.environment }
83
+ };
84
+ return candidate;
85
+ });
86
+ }
87
+ buildCandidate_interactively(partial, rootMap, takeDefaults) {
88
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
89
+ // TODO:
90
+ // 1) select an enterprise (if > 1)
91
+ // 2) select a role (render already assigned w rwx or read/modify)
92
+ // 3) multi-select privileges (w existing pre-selected)
93
+ return yield this.buildCandidate_silently(partial, rootMap);
94
+ });
95
+ }
96
+ buildCommandString(candidate, cmd) {
97
+ cmd.push("--enterprise", candidate.enterprise);
98
+ cmd.push("--environment", candidate.environment);
99
+ cmd.push("--role", candidate.role);
100
+ cmd.push("--privilege", candidate.privilege);
101
+ cmd.push("--silent");
102
+ return cmd;
103
+ }
104
+ executeTask(candidate) {
105
+ var _a, _b;
106
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
107
+ // throw new Error("Auth.setEntityPermission not yet implemented on api");
108
+ const req = {
109
+ entityType: candidate.entityType,
110
+ entityKey: candidate.entityKey,
111
+ role: candidate.role,
112
+ privileges: candidate.privileges,
113
+ comprehensive: true
114
+ };
115
+ let result = yield this._codiacApi.Auth.SetEntityPermission(req);
116
+ if (result.error)
117
+ throw result.error;
118
+ if (result.success) {
119
+ this._ui.userMessage(this._styler.colorGood("Success! ").concat((_a = result.message) !== null && _a !== void 0 ? _a : "Assigned permissions."));
120
+ }
121
+ else {
122
+ this._ui.userMessage((_b = result.message) !== null && _b !== void 0 ? _b : "Failed to assign permissions (no details given, see log for details)");
123
+ }
124
+ return;
125
+ });
126
+ }
127
+ }
128
+ exports.default = AuthEnvironmentAllow;
129
+ AuthEnvironmentAllow.description = 'Sets permissions for a security Role on the given environment entity. (NOT additive: this command overwrites any existing permissions set for this role on the entity).';
130
+ AuthEnvironmentAllow.aliases = ["auth:enviro:allow"];
131
+ AuthEnvironmentAllow.examples = [
132
+ '<%= config.bin %> <%= command.id %> --enteprise main --environment dev --role developer --privilege modify',
133
+ '<%= config.bin %> <%= command.id %> -e prod -r developer -p none',
134
+ '<%= config.bin %> <%= command.id %> -e qa -r productmanager -p read'
135
+ ];
136
+ AuthEnvironmentAllow.flags = {
137
+ enterprise: core_1.Flags.string({ required: false, description: 'Name of the Enterprise containing the environemnt. (Required only if more than one exists).' }),
138
+ environment: core_1.Flags.string({ char: 'e', required: false, description: 'Name of the Environment being protected. Required in silent mode.' }),
139
+ role: core_1.Flags.string({ char: 'r', required: false, description: 'Name of the Role being assigned. Required in silent mode.' }),
140
+ privilege: core_1.Flags.string({ char: 'p', required: true, options: Object.keys(PrivilegeAbbrevsEnum), description: 'The permission to assign to the Role. ("modify" infers permission to create, read, update, and delete. "none" removes any permissions set for the role)' }),
141
+ // TODO: Move these into the base class
142
+ silent: core_1.Flags.boolean({ exclusive: ["echo", "to-script"], description: 'Non-Interactive mode; executes without any user interaction and fails on any missing or invalid arguments.' }),
143
+ echo: core_1.Flags.boolean({ exclusive: ["to-script", "silent"], description: 'Echo interaction mode; renders the equivalent non-interactive cli command for future use before final execution.' }),
144
+ "to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
145
+ "take-defaults": core_1.Flags.boolean({ exclusive: ["silent"], description: "Setting this to true prevents prompting for confirmation on parameters that were passed in or were automatically set to default values (Irrelevant in --silent mode). This behavior does NOT apply to scenarios that the command needs to override invalid user input; such cases will always prompt for confirmation. eg: when no argument was provided for file or type, and only one exists, the system will render the autoselected file unless this flag is set." })
146
+ };
147
+ AuthEnvironmentAllow.args = {};
148
+ //# sourceMappingURL=allow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allow.js","sourceRoot":"","sources":["../../../../src/commands/auth/environment/allow.ts"],"names":[],"mappings":";;;;AAAA,sCAAmC;AACnC,4BAA6B;AAE7B,sEAAoE;AACpE,kEAAwE;AACxE,kEAA6D;AAI7D,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,yCAAmB,CAAA;IACnB,qCAAe,CAAA;IACf,qCAAe,CAAA;AACjB,CAAC,EAJW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAI/B;AAWD,MAAqB,oBAAqB,SAAQ,mCAA4B;IAA9E;;QAyBY,cAAS,GAAG,IAAI,CAAC;IA2H7B,CAAC;IAzHc,WAAW,CAAC,cAAsB;;;YAC7C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAE/D,IAAI,OAAO,GAAuC;gBAChD,UAAU,EAAE,cAAc;aAC3B,CAAC;YAEF,IAAI,KAAK,CAAC,UAAU;gBAAE,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YAC5D,IAAI,KAAK,CAAC,WAAW;gBAAE,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;YAC/D,IAAI,KAAK,CAAC,IAAI;gBAAE,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YAC1C,IAAI,KAAK,CAAC,SAAS,EAAE;gBACnB,OAAO,CAAC,SAAS,GAAS,oBAAqB,CAAC,KAAK,CAAC,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AAsG,EAAE,CAAC;IAClL,eAAe,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,ycAAyc,EAAE,CAAC;CAClhB,CAAA;AAEM,yBAAI,GAAG,EAAE,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { AtLeast } from "@codiac.io/codiac-common/contracts";
2
+ import { InteractionModes } from '../../../uilogic/config-ui-utils';
3
+ import { RootMap } from '../../../apis/codiac-api/contracts';
4
+ import { CommandBaseExec } from '../../../command-base-exec';
5
+ export declare enum PrivilegeAbbrevsEnum {
6
+ "modify" = "modify",
7
+ "read" = "read",
8
+ "none" = "none"
9
+ }
10
+ export interface IRootMapHolder {
11
+ rootMap: RootMap;
12
+ }
13
+ export type IPermission = {
14
+ enterprise: string;
15
+ environment: string;
16
+ role?: string;
17
+ privilege?: PrivilegeAbbrevsEnum;
18
+ } & IRootMapHolder;
19
+ export default class AuthEnvironmentAllowed extends CommandBaseExec<IPermission> {
20
+ static description: string;
21
+ static aliases: string[];
22
+ static examples: string[];
23
+ static flags: {
24
+ enterprise: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
25
+ environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
26
+ silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
27
+ echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
28
+ "to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
29
+ "take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
30
+ };
31
+ static args: {};
32
+ protected adminOnly: boolean;
33
+ captureArgs(enterpriseCode: string): Promise<[AtLeast<IPermission, "enterprise">, InteractionModes | undefined, boolean]>;
34
+ buildCandidate_silently(partial: AtLeast<IPermission, "enterprise">, rootMap: RootMap): Promise<IPermission | undefined>;
35
+ buildCandidate_interactively(partial: AtLeast<IPermission, "enterprise">, rootMap: RootMap, takeDefaults: boolean): Promise<IPermission | undefined>;
36
+ buildCommandString(candidate: IPermission, cmd: string[]): string[];
37
+ executeTask(candidate: IPermission): Promise<void>;
38
+ private permsFrom;
39
+ /** constructs a "rwd" string from the given set of privileges. */
40
+ private toRwd;
41
+ private buildPermissionTree;
42
+ }
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrivilegeAbbrevsEnum = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@oclif/core");
6
+ const _ = require("lodash");
7
+ const render = require("../../../uilogic/render-methods");
8
+ const config_ui_utils_1 = require("../../../uilogic/config-ui-utils");
9
+ const contracts_1 = require("../../../apis/codiac-api/contracts");
10
+ const command_base_exec_1 = require("../../../command-base-exec");
11
+ var PrivilegeAbbrevsEnum;
12
+ (function (PrivilegeAbbrevsEnum) {
13
+ PrivilegeAbbrevsEnum["modify"] = "modify";
14
+ PrivilegeAbbrevsEnum["read"] = "read";
15
+ PrivilegeAbbrevsEnum["none"] = "none";
16
+ })(PrivilegeAbbrevsEnum = exports.PrivilegeAbbrevsEnum || (exports.PrivilegeAbbrevsEnum = {}));
17
+ class AuthEnvironmentAllowed extends command_base_exec_1.CommandBaseExec {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.adminOnly = true;
21
+ }
22
+ captureArgs(enterpriseCode) {
23
+ var _a, _b;
24
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
+ const { args, flags } = yield this.parse(AuthEnvironmentAllowed);
26
+ let partial = {
27
+ enterprise: enterpriseCode
28
+ };
29
+ if (flags.enterprise)
30
+ partial.enterprise = flags.enterprise;
31
+ if (flags.environment)
32
+ partial.environment = flags.environment;
33
+ if (flags.role)
34
+ partial.role = flags.role;
35
+ if (flags.privilege) {
36
+ partial.privilege = PrivilegeAbbrevsEnum[flags.privilege];
37
+ // switch (flags.privilege) {
38
+ // case PrivilegeAbbrevsEnum.modify:
39
+ // partial.privileges = [Privilege.Create, Privilege.Read, Privilege.Update, Privilege.Delete];
40
+ // break;
41
+ // case PrivilegeAbbrevsEnum.read:
42
+ // partial.privileges = [Privilege.Read];
43
+ // break;
44
+ // case PrivilegeAbbrevsEnum.none:
45
+ // default:
46
+ // partial.privileges = [];
47
+ // break;
48
+ // }
49
+ }
50
+ // ---------------------------------------------------------------
51
+ // TODO: move everything from here down into the base class
52
+ // ---------------------------------------------------------------
53
+ const interactionMode = (this.pipedInput) ? config_ui_utils_1.InteractionModes.silent : (_b = (_a = undefined !== null && undefined !== void 0 ? undefined : (flags.echo ? config_ui_utils_1.InteractionModes.echo : undefined)) !== null && _a !== void 0 ? _a : (flags["to-script"] ? config_ui_utils_1.InteractionModes.toscript : undefined)) !== null && _b !== void 0 ? _b : (flags.silent ? config_ui_utils_1.InteractionModes.silent : undefined);
54
+ const takeDefaults = flags['take-defaults'];
55
+ return [partial, interactionMode, takeDefaults];
56
+ });
57
+ }
58
+ // /** Throws on invalid */
59
+ // private validate(partial: Partial<IAuthRoleDef>): void {
60
+ // if (partial.name == undefined || _.isEmpty(partial.name)) throw new Error("Missing name");
61
+ // let rxName = /^[a-zA-Z][a-zA-Z0-9-]{2,50}$/;
62
+ // if (!rxName.test(partial.name)) throw new Error("Invalid name: must be 3- to 50-character string of alphanumerics and hyphens, starting with a letter.");
63
+ // }
64
+ buildCandidate_silently(partial, rootMap) {
65
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
66
+ if (partial.enterprise == undefined || _.isEmpty(partial.enterprise))
67
+ throw new Error("Must specify enterprise.");
68
+ if (partial.environment == undefined || _.isEmpty(partial.environment))
69
+ throw new Error("Must specify environment.");
70
+ // if (partial.role == undefined || _.isEmpty(partial.role)) throw new Error("Must specify role.");
71
+ // if (partial.privilege == undefined || _.isEmpty(partial.privilege)) throw new Error("Must specify privilege.");
72
+ // if (partial.privileges == undefined) throw new Error("Must specify privileges.");
73
+ let candidate = {
74
+ enterprise: partial.enterprise,
75
+ environment: partial.environment,
76
+ rootMap: rootMap
77
+ };
78
+ if (partial.privilege)
79
+ candidate.privilege = partial.privilege;
80
+ if (partial.role)
81
+ candidate.role = partial.role;
82
+ return candidate;
83
+ });
84
+ }
85
+ buildCandidate_interactively(partial, rootMap, takeDefaults) {
86
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
87
+ // TODO:
88
+ // 1) select an enterprise (if > 1)
89
+ // 2) select a role (render already assigned w rwx or read/modify)
90
+ // 3) multi-select privileges (w existing pre-selected)
91
+ return yield this.buildCandidate_silently(partial, rootMap);
92
+ });
93
+ }
94
+ buildCommandString(candidate, cmd) {
95
+ cmd.push("--enterprise", candidate.enterprise);
96
+ cmd.push("--environment", candidate.environment);
97
+ if (candidate.role)
98
+ cmd.push("--role", candidate.role);
99
+ if (candidate.privilege)
100
+ cmd.push("--privilege", candidate.privilege);
101
+ cmd.push("--silent");
102
+ return cmd;
103
+ }
104
+ executeTask(candidate) {
105
+ var _a, _b;
106
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
107
+ let ent = candidate.rootMap.enterprises.find(e => e.name == candidate.enterprise);
108
+ if (!ent)
109
+ throw new Error("Enterprise not found.");
110
+ let env = ent.environments.find(e => e.name == candidate.environment);
111
+ if (!env)
112
+ throw new Error("Environment not found.");
113
+ // Perms on the entity
114
+ let perms = this.permsFrom(env);
115
+ let envTree = this.buildPermissionTree(this._styler.hilite(env.name), perms);
116
+ let entTree = [{ text: ent.name.concat(" enterprise:"), children: envTree }];
117
+ let output = render.renderStringTree(entTree);
118
+ this._ui.userMessage(output);
119
+ // Default child perms
120
+ let childPerms = (_b = (_a = env.defaultCabinetAcl) === null || _a === void 0 ? void 0 : _a.permissions) !== null && _b !== void 0 ? _b : perms;
121
+ const childTree = this.buildPermissionTree("New cabinets in ".concat(env.name, "..."), childPerms);
122
+ const defChildOutput = render.renderStringTree(childTree);
123
+ this._ui.userMessage(defChildOutput);
124
+ return;
125
+ });
126
+ }
127
+ permsFrom(entity) {
128
+ var _a, _b, _c;
129
+ let perms = {};
130
+ (_a = entity.readableBy) === null || _a === void 0 ? void 0 : _a.forEach(r => { if (perms[r] == undefined)
131
+ perms[r] = []; perms[r].push(contracts_1.Privilege.Read); });
132
+ (_b = entity.writeableBy) === null || _b === void 0 ? void 0 : _b.forEach(r => { if (perms[r] == undefined)
133
+ perms[r] = []; perms[r].push(contracts_1.Privilege.Update); });
134
+ (_c = entity.deleteableBy) === null || _c === void 0 ? void 0 : _c.forEach(r => { if (perms[r] == undefined)
135
+ perms[r] = []; perms[r].push(contracts_1.Privilege.Delete); });
136
+ return perms;
137
+ }
138
+ /** constructs a "rwd" string from the given set of privileges. */
139
+ toRwd(privs) {
140
+ let rwd = "";
141
+ if (privs.includes(contracts_1.Privilege.Read))
142
+ rwd = rwd.concat("r");
143
+ if (privs.includes(contracts_1.Privilege.Update))
144
+ rwd = rwd.concat("w");
145
+ if (privs.includes(contracts_1.Privilege.Delete))
146
+ rwd = rwd.concat("d");
147
+ return rwd;
148
+ }
149
+ buildPermissionTree(title, perms) {
150
+ let output = [];
151
+ let root = { text: title, children: [] };
152
+ if (_.isEmpty(perms)) {
153
+ root.children.push({ text: "(admin only)" });
154
+ }
155
+ else {
156
+ for (let role in perms) {
157
+ root.children.push({ text: "(".concat(this._styler.hilite(this.toRwd(perms[role])), ") ", role) });
158
+ }
159
+ }
160
+ return [root];
161
+ }
162
+ }
163
+ exports.default = AuthEnvironmentAllowed;
164
+ AuthEnvironmentAllowed.description = 'Shows permissions for each security role on the given environment entity.';
165
+ AuthEnvironmentAllowed.aliases = ["auth:env:allowed"];
166
+ AuthEnvironmentAllowed.examples = [
167
+ '<%= config.bin %> <%= command.id %> -e dev',
168
+ '<%= config.bin %> <%= command.id %> --enterprise modeling -e dev'
169
+ ];
170
+ AuthEnvironmentAllowed.flags = {
171
+ enterprise: core_1.Flags.string({ required: false, description: 'Name of the Enterprise containing the environment. (Required only if more than one exists).' }),
172
+ environment: core_1.Flags.string({ char: 'e', required: false, description: 'Name of the Environment to view. Required in silent mode.' }),
173
+ // role: Flags.string({ char: 'r', required: false, description: 'Name of the Role being assigned. Required in silent mode.' }),
174
+ // privilege: Flags.string({ char: 'p', required: true, options: Object.keys(PrivilegeAbbrevsEnum), description: 'The permission to assign to the Role. ("modify" infers permission to create, read, update, and delete. "none" removes any permissions set for the role)' }),
175
+ // TODO: Move these into the base class
176
+ silent: core_1.Flags.boolean({ exclusive: ["echo", "to-script"], description: 'Non-Interactive mode; executes without any user interaction and fails on any missing or invalid arguments.' }),
177
+ echo: core_1.Flags.boolean({ exclusive: ["to-script", "silent"], description: 'Echo interaction mode; renders the equivalent non-interactive cli command for future use before final execution.' }),
178
+ "to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
179
+ "take-defaults": core_1.Flags.boolean({ exclusive: ["silent"], description: "Setting this to true prevents prompting for confirmation on parameters that were passed in or were automatically set to default values (Irrelevant in --silent mode). This behavior does NOT apply to scenarios that the command needs to override invalid user input; such cases will always prompt for confirmation. eg: when no argument was provided for file or type, and only one exists, the system will render the autoselected file unless this flag is set." })
180
+ };
181
+ AuthEnvironmentAllowed.args = {};
182
+ //# sourceMappingURL=allowed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed.js","sourceRoot":"","sources":["../../../../src/commands/auth/environment/allowed.ts"],"names":[],"mappings":";;;;AAAA,sCAAmC;AACnC,4BAA6B;AAI7B,0DAA0D;AAC1D,sEAAoE;AACpE,kEAAwE;AACxE,kEAA6D;AAG7D,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,yCAAmB,CAAA;IACnB,qCAAe,CAAA;IACf,qCAAe,CAAA;AACjB,CAAC,EAJW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAI/B;AASD,MAAqB,sBAAuB,SAAQ,mCAA4B;IAAhF;;QAwBY,cAAS,GAAG,IAAI,CA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is/codiac-api/contracts';
3
+ import { commandBase } from '../../cli-common';
4
+ import { InteractionModes } from '../../uilogic/config-ui-utils';
5
+ export default class AuthRegister extends commandBase {
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ email: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ password: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ passwordIn: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ company: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
+ companyCode: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
14
+ firstName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
15
+ lastName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
16
+ silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
+ echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
+ "to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
+ "take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
+ };
21
+ static args: {};
22
+ protected get codiacApiUrl(): string;
23
+ private __codiacApiUrl;
24
+ /** TODO: Get this out of the CLI. Any calls to the codiac api should be made from the relay. */
25
+ protected get _codiacApi(): CodiacClient;
26
+ private __codiacApi;
27
+ protected bootstrap(): void;
28
+ run(): Promise<void>;
29
+ captureArgs(): Promise<[Partial<TenantRegistrationRequest>, InteractionModes | undefined, boolean]>;
30
+ private buildCandidate_silently;
31
+ private execute;
32
+ }