@codiac.io/codiac-cli 1.2.264 → 1.3.2
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/README.md +1 -1
- package/dist/apis/codiac-api/common/api-client-base.d.ts +21 -7
- package/dist/apis/codiac-api/common/api-client-base.js +8 -6
- package/dist/apis/codiac-api/common/api-client-base.js.map +1 -1
- package/dist/apis/codiac-api/gen/client.d.ts +268 -198
- package/dist/apis/codiac-api/gen/client.js +2464 -970
- package/dist/apis/codiac-api/gen/client.js.map +1 -1
- package/dist/apis/codiac-api/gen/contracts.d.ts +171 -33
- package/dist/apis/codiac-api/gen/contracts.js +72 -76
- package/dist/apis/codiac-api/gen/contracts.js.map +1 -1
- package/dist/apis/codiac-relay/gen/client.d.ts +2 -2
- package/dist/apis/codiac-relay/gen/client.js.map +1 -1
- package/dist/cli-common/command-base.d.ts +10 -0
- package/dist/cli-common/command-base.js +21 -0
- package/dist/cli-common/command-base.js.map +1 -1
- package/dist/command-base-enterprise.d.ts +11 -11
- package/dist/command-base-enterprise.js +83 -60
- package/dist/command-base-enterprise.js.map +1 -1
- package/dist/command-base-exec-tenant.d.ts +21 -0
- package/dist/command-base-exec-tenant.js +72 -0
- package/dist/command-base-exec-tenant.js.map +1 -0
- package/dist/command-base-tenantless.d.ts +0 -5
- package/dist/command-base-tenantless.js +0 -11
- package/dist/command-base-tenantless.js.map +1 -1
- package/dist/commands/asset/deploy.js +1 -0
- package/dist/commands/asset/deploy.js.map +1 -1
- package/dist/commands/auth/cabinet/allow.d.ts +49 -0
- package/dist/commands/auth/cabinet/allow.js +155 -0
- package/dist/commands/auth/cabinet/allow.js.map +1 -0
- package/dist/commands/auth/cabinet/allowed.d.ts +44 -0
- package/dist/commands/auth/cabinet/allowed.js +187 -0
- package/dist/commands/auth/cabinet/allowed.js.map +1 -0
- package/dist/commands/auth/enterprise/allow/onEnvironments.d.ts +41 -0
- package/dist/commands/auth/enterprise/allow/onEnvironments.js +146 -0
- package/dist/commands/auth/enterprise/allow/onEnvironments.js.map +1 -0
- package/dist/commands/auth/enterprise/allow.d.ts +43 -0
- package/dist/commands/auth/enterprise/allow.js +140 -0
- package/dist/commands/auth/enterprise/allow.js.map +1 -0
- package/dist/commands/auth/enterprise/allowed.d.ts +40 -0
- package/dist/commands/auth/enterprise/allowed.js +171 -0
- package/dist/commands/auth/enterprise/allowed.js.map +1 -0
- package/dist/commands/auth/environment/allow/onCabinets.d.ts +43 -0
- package/dist/commands/auth/environment/allow/onCabinets.js +156 -0
- package/dist/commands/auth/environment/allow/onCabinets.js.map +1 -0
- package/dist/commands/auth/environment/allow.d.ts +46 -0
- package/dist/commands/auth/environment/allow.js +148 -0
- package/dist/commands/auth/environment/allow.js.map +1 -0
- package/dist/commands/auth/environment/allowed.d.ts +42 -0
- package/dist/commands/auth/environment/allowed.js +182 -0
- package/dist/commands/auth/environment/allowed.js.map +1 -0
- package/dist/commands/auth/register.d.ts +32 -0
- package/dist/commands/auth/register.js +170 -0
- package/dist/commands/auth/register.js.map +1 -0
- package/dist/commands/auth/role/allowed.d.ts +33 -0
- package/dist/commands/auth/role/allowed.js +135 -0
- package/dist/commands/auth/role/allowed.js.map +1 -0
- package/dist/commands/auth/role/assign.d.ts +26 -0
- package/dist/commands/auth/role/assign.js +92 -0
- package/dist/commands/auth/role/assign.js.map +1 -0
- package/dist/commands/auth/role/create.d.ts +24 -0
- package/dist/commands/auth/role/create.js +90 -0
- package/dist/commands/auth/role/create.js.map +1 -0
- package/dist/commands/auth/role/delete.d.ts +28 -0
- package/dist/commands/auth/role/delete.js +119 -0
- package/dist/commands/auth/role/delete.js.map +1 -0
- package/dist/commands/auth/role/list.d.ts +26 -0
- package/dist/commands/auth/role/list.js +108 -0
- package/dist/commands/auth/role/list.js.map +1 -0
- package/dist/commands/auth/role/unassign.d.ts +26 -0
- package/dist/commands/auth/role/unassign.js +92 -0
- package/dist/commands/auth/role/unassign.js.map +1 -0
- package/dist/commands/auth/user/invite.d.ts +24 -0
- package/dist/commands/auth/user/invite.js +105 -0
- package/dist/commands/auth/user/invite.js.map +1 -0
- package/dist/commands/auth/user/list.d.ts +26 -0
- package/dist/commands/auth/user/list.js +118 -0
- package/dist/commands/auth/user/list.js.map +1 -0
- package/dist/commands/cabinet/create.d.ts +1 -1
- package/dist/commands/cabinet/create.js +28 -20
- package/dist/commands/cabinet/create.js.map +1 -1
- package/dist/commands/cabinet/list.d.ts +1 -0
- package/dist/commands/cabinet/list.js +9 -1
- package/dist/commands/cabinet/list.js.map +1 -1
- package/dist/commands/cabinet/obliterate.js +39 -34
- package/dist/commands/cabinet/obliterate.js.map +1 -1
- package/dist/commands/config/deploy.js +5 -2
- package/dist/commands/config/deploy.js.map +1 -1
- package/dist/commands/enterprise/create.js +1 -1
- package/dist/commands/enterprise/create.js.map +1 -1
- package/dist/commands/environment/create.d.ts +1 -0
- package/dist/commands/environment/create.js +4 -2
- package/dist/commands/environment/create.js.map +1 -1
- package/dist/commands/secretStore/list.js +2 -2
- package/dist/commands/secretStore/list.js.map +1 -1
- package/dist/commands/tenant/create.d.ts +0 -2
- package/dist/commands/tenant/create.js +0 -33
- package/dist/commands/tenant/create.js.map +1 -1
- package/dist/commands/tenant/switch.d.ts +0 -2
- package/dist/commands/tenant/switch.js +0 -33
- package/dist/commands/tenant/switch.js.map +1 -1
- package/dist/commands/whoami.d.ts +3 -1
- package/dist/commands/whoami.js +8 -2
- package/dist/commands/whoami.js.map +1 -1
- package/dist/ops/data/cli-context-repo.js +2 -2
- package/dist/ops/data/cli-context-repo.js.map +1 -1
- package/dist/relay/relay-container.js +1 -1
- package/dist/uilogic/rootmap-ui-utils.js +38 -8
- package/dist/uilogic/rootmap-ui-utils.js.map +1 -1
- package/dist/uilogic/tenant-contextualizer.js +8 -2
- package/dist/uilogic/tenant-contextualizer.js.map +1 -1
- package/dist/user-context-loader.d.ts +1 -1
- package/dist/user-context-loader.js +3 -2
- package/dist/user-context-loader.js.map +1 -1
- package/oclif.manifest.json +1597 -93
- package/package.json +4 -4
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AuthRole } from '../../../apis/codiac-api/contracts';
|
|
2
|
+
import { InteractionModes } from '../../../uilogic/config-ui-utils';
|
|
3
|
+
import { CommandBaseExecTenant } from '../../../command-base-exec-tenant';
|
|
4
|
+
export type IAuthRoleSelector = {
|
|
5
|
+
id?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
};
|
|
8
|
+
export default class AuthRoleDelete extends CommandBaseExecTenant<IAuthRoleSelector> {
|
|
9
|
+
static description: string;
|
|
10
|
+
static aliases: never[];
|
|
11
|
+
static examples: string[];
|
|
12
|
+
static flags: {
|
|
13
|
+
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
"take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
};
|
|
19
|
+
static args: {
|
|
20
|
+
name: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
|
|
21
|
+
};
|
|
22
|
+
protected adminOnly: boolean;
|
|
23
|
+
captureArgs(): Promise<[Partial<IAuthRoleSelector>, InteractionModes | undefined, boolean]>;
|
|
24
|
+
buildCandidate_silently(partial: Partial<IAuthRoleSelector>): Promise<IAuthRoleSelector | undefined>;
|
|
25
|
+
buildCandidate_interactively(partial: Partial<IAuthRoleSelector>, takeDefaults: boolean): Promise<IAuthRoleSelector | undefined>;
|
|
26
|
+
buildCommandString(candidate: AuthRole, cmd: string[]): string[];
|
|
27
|
+
executeTask(candidate: AuthRole): Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const contracts_1 = require("@codiac.io/codiac-common/contracts");
|
|
6
|
+
const security_1 = require("@codiac.io/codiac-common/security");
|
|
7
|
+
const config_ui_utils_1 = require("../../../uilogic/config-ui-utils");
|
|
8
|
+
const command_base_exec_tenant_1 = require("../../../command-base-exec-tenant");
|
|
9
|
+
class AuthRoleDelete extends command_base_exec_tenant_1.CommandBaseExecTenant {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.adminOnly = true;
|
|
13
|
+
}
|
|
14
|
+
captureArgs() {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const { args, flags } = yield this.parse(AuthRoleDelete);
|
|
18
|
+
let partial = {};
|
|
19
|
+
if (args.name && flags.id) {
|
|
20
|
+
throw new Error("You must specify either the role name argument or the --id flag, not both.");
|
|
21
|
+
}
|
|
22
|
+
if (args.name)
|
|
23
|
+
partial.name = args.name;
|
|
24
|
+
if (flags.id)
|
|
25
|
+
partial.id = flags.id;
|
|
26
|
+
// ---------------------------------------------------------------
|
|
27
|
+
// TODO: move everything from here down into the base class
|
|
28
|
+
// ---------------------------------------------------------------
|
|
29
|
+
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);
|
|
30
|
+
const takeDefaults = flags['take-defaults'];
|
|
31
|
+
return [partial, interactionMode, takeDefaults];
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
// /** Throws on invalid */
|
|
35
|
+
// private validate(partial: Partial<IAuthRoleDef>): void {
|
|
36
|
+
// if (partial.name == undefined || _.isEmpty(partial.name)) throw new Error("Missing name");
|
|
37
|
+
// let rxName = /^[a-zA-Z][a-zA-Z0-9-]{2,50}$/;
|
|
38
|
+
// 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.");
|
|
39
|
+
// }
|
|
40
|
+
buildCandidate_silently(partial) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (partial.id == undefined && partial.name == undefined)
|
|
43
|
+
throw new Error("Must specify either id or name.");
|
|
44
|
+
let candidate = {};
|
|
45
|
+
if (partial.id) {
|
|
46
|
+
candidate.id = partial.id;
|
|
47
|
+
}
|
|
48
|
+
else if (partial.name) {
|
|
49
|
+
if (partial.name == security_1.AUTH_ADMIN_ROLE_NAME)
|
|
50
|
+
throw new Error("The Built-in '".concat(security_1.AUTH_ADMIN_ROLE_NAME, "' role cannot be deleted."));
|
|
51
|
+
let rxName = /^[a-zA-Z][a-zA-Z0-9-]{2,50}$/;
|
|
52
|
+
if (!rxName.test(partial.name))
|
|
53
|
+
throw new Error("Invalid name: must be 3- to 50-character string of alphanumerics and hyphens, starting with a letter.");
|
|
54
|
+
candidate.name = partial.name;
|
|
55
|
+
}
|
|
56
|
+
return candidate;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
buildCandidate_interactively(partial, takeDefaults) {
|
|
60
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return yield this.buildCandidate_silently(partial);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
buildCommandString(candidate, cmd) {
|
|
65
|
+
if (candidate.id) {
|
|
66
|
+
cmd.push("--id", candidate.id);
|
|
67
|
+
}
|
|
68
|
+
else if (candidate.name) {
|
|
69
|
+
cmd.push("--name", candidate.name);
|
|
70
|
+
}
|
|
71
|
+
cmd.push("--silent");
|
|
72
|
+
return cmd;
|
|
73
|
+
}
|
|
74
|
+
executeTask(candidate) {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
let result = new contracts_1.SingleResult(false);
|
|
78
|
+
if (candidate.id) {
|
|
79
|
+
// result = await this._codiacApi.AuthRole.tryDelete({ id: candidate.id });
|
|
80
|
+
let found = yield this._codiacApi.AuthRole.read({ id: candidate.id }, { throwNotFound: true });
|
|
81
|
+
if (found.name == security_1.AUTH_ADMIN_ROLE_NAME)
|
|
82
|
+
throw new Error("The Built-in '".concat(security_1.AUTH_ADMIN_ROLE_NAME, "' role cannot be deleted."));
|
|
83
|
+
// result = await this._codiacApi.AuthRole.tryDeleteWhere({ ids: [candidate.id], name: { $not: { $eq: AUTH_ADMIN_ROLE_NAME } } });
|
|
84
|
+
result = yield this._codiacApi.Auth.RoleDelete({ id: candidate.id });
|
|
85
|
+
}
|
|
86
|
+
else if (candidate.name) {
|
|
87
|
+
result = yield this._codiacApi.AuthRole.tryDeleteWhere({ name: { $eq: candidate.name } });
|
|
88
|
+
}
|
|
89
|
+
if (result.error)
|
|
90
|
+
throw result.error;
|
|
91
|
+
if (result.success) {
|
|
92
|
+
this._ui.userMessage(this._styler.colorGood("Success! ").concat((_a = result.message) !== null && _a !== void 0 ? _a : "Deleted Role."));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this._ui.userMessage((_b = result.message) !== null && _b !== void 0 ? _b : "Failed to delete: Role not found.");
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.default = AuthRoleDelete;
|
|
102
|
+
AuthRoleDelete.description = 'Deletes an existing Role from the current tenant security context. A role cannot be deleted if it is still assigned to an existing user or group.';
|
|
103
|
+
AuthRoleDelete.aliases = [];
|
|
104
|
+
AuthRoleDelete.examples = [
|
|
105
|
+
'<%= config.bin %> <%= command.id %> -n deployer',
|
|
106
|
+
'<%= config.bin %> <%= command.id %> --id abc123def456'
|
|
107
|
+
];
|
|
108
|
+
AuthRoleDelete.flags = {
|
|
109
|
+
id: core_1.Flags.string({ required: false, exclusive: ["name"], description: 'System ID of the Role.' }),
|
|
110
|
+
// TODO: Move these into the base class
|
|
111
|
+
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.' }),
|
|
112
|
+
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.' }),
|
|
113
|
+
"to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
|
|
114
|
+
"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." })
|
|
115
|
+
};
|
|
116
|
+
AuthRoleDelete.args = {
|
|
117
|
+
name: core_1.Args.string({ required: false, exclusive: ["id"], description: 'Name of the Role.' }),
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/auth/role/delete.ts"],"names":[],"mappings":";;;AAAA,sCAAyC;AAGzC,kEAA0E;AAC1E,gEAAyE;AACzE,sEAAoE;AACpE,gFAA0E;AAM1E,MAAqB,cAAe,SAAQ,gDAAwC;IAApF;;QAuBY,cAAS,GAAG,IAAI,CAAC;IA4G7B,CAAC;IA1Gc,WAAW;;;YACtB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,C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QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;IAEjG,uCAAuC;IACvC,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,4GAA4G,EAAE,CAAC;IACtL,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,kHAAkH,EAAE,CAAC;IAC5L,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,sGAAsG,EAAE,CAAC;IAClL,eAAe,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,ycAAyc,EAAE,CAAC;CAClhB,CAAA;AAEM,mBAAI,GAAG;IACZ,IAAI,EAAE,WAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;CAC5F,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AuthRoleCriteria } from '../../../apis/codiac-api/contracts';
|
|
2
|
+
import { InteractionModes } from '../../../uilogic/config-ui-utils';
|
|
3
|
+
import { CommandBaseExecTenant } from '../../../command-base-exec-tenant';
|
|
4
|
+
import { OutputFormatsEnum } from '../../../uilogic';
|
|
5
|
+
export type IAuthRoleQuery = AuthRoleCriteria & {
|
|
6
|
+
outputFormat: OutputFormatsEnum;
|
|
7
|
+
};
|
|
8
|
+
export default class AuthRoleList extends CommandBaseExecTenant<IAuthRoleQuery> {
|
|
9
|
+
static description: string;
|
|
10
|
+
static aliases: never[];
|
|
11
|
+
static examples: string[];
|
|
12
|
+
static flags: {
|
|
13
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
"take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
};
|
|
19
|
+
static args: {};
|
|
20
|
+
protected adminOnly: boolean;
|
|
21
|
+
captureArgs(): Promise<[Partial<IAuthRoleQuery>, InteractionModes | undefined, boolean]>;
|
|
22
|
+
buildCandidate_silently(partial: Partial<IAuthRoleQuery>): Promise<IAuthRoleQuery | undefined>;
|
|
23
|
+
buildCandidate_interactively(partial: Partial<IAuthRoleQuery>, takeDefaults: boolean): Promise<IAuthRoleQuery | undefined>;
|
|
24
|
+
buildCommandString(candidate: IAuthRoleQuery, cmd: string[]): string[];
|
|
25
|
+
executeTask(candidate: IAuthRoleQuery): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const _ = require("lodash");
|
|
6
|
+
const YAML = require("yaml");
|
|
7
|
+
const render = require("../../../uilogic/render-methods");
|
|
8
|
+
const config_ui_utils_1 = require("../../../uilogic/config-ui-utils");
|
|
9
|
+
const command_base_exec_tenant_1 = require("../../../command-base-exec-tenant");
|
|
10
|
+
const uilogic_1 = require("../../../uilogic");
|
|
11
|
+
class AuthRoleList extends command_base_exec_tenant_1.CommandBaseExecTenant {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.adminOnly = true;
|
|
15
|
+
}
|
|
16
|
+
captureArgs() {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const { args, flags } = yield this.parse(AuthRoleList);
|
|
20
|
+
let partial = {};
|
|
21
|
+
if (flags.output)
|
|
22
|
+
partial.outputFormat = uilogic_1.OutputFormatsEnum[flags.output];
|
|
23
|
+
// ---------------------------------------------------------------
|
|
24
|
+
// TODO: move everything from here down into the base class
|
|
25
|
+
// ---------------------------------------------------------------
|
|
26
|
+
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);
|
|
27
|
+
const takeDefaults = flags['take-defaults'];
|
|
28
|
+
return [partial, interactionMode, takeDefaults];
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// /** Throws on invalid */
|
|
32
|
+
// private validate(partial: Partial<IAuthRoleDef>): void {
|
|
33
|
+
// if (partial.name == undefined || _.isEmpty(partial.name)) throw new Error("Missing name");
|
|
34
|
+
// let rxName = /^[a-zA-Z][a-zA-Z0-9-]{2,50}$/;
|
|
35
|
+
// 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.");
|
|
36
|
+
// }
|
|
37
|
+
buildCandidate_silently(partial) {
|
|
38
|
+
var _a;
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
let candidate = {
|
|
41
|
+
outputFormat: (_a = partial.outputFormat) !== null && _a !== void 0 ? _a : uilogic_1.OutputFormatsEnum.text
|
|
42
|
+
};
|
|
43
|
+
candidate.all = true;
|
|
44
|
+
return candidate;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
buildCandidate_interactively(partial, takeDefaults) {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
return yield this.buildCandidate_silently(partial);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
buildCommandString(candidate, cmd) {
|
|
53
|
+
cmd.push("--output", candidate.outputFormat);
|
|
54
|
+
cmd.push("--silent");
|
|
55
|
+
return cmd;
|
|
56
|
+
}
|
|
57
|
+
executeTask(candidate) {
|
|
58
|
+
var _a, _b, _c;
|
|
59
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
if ([uilogic_1.OutputFormatsEnum.json, uilogic_1.OutputFormatsEnum.yaml].includes(candidate.outputFormat) === false)
|
|
61
|
+
this._ui.startSpinner("Retrieving");
|
|
62
|
+
let crit = _.omit(candidate, "outputFormat");
|
|
63
|
+
let result = yield this._codiacApi.AuthRole.tryReadMany(crit);
|
|
64
|
+
let doneMsg = (result.error) ? "Error" : "Found ".concat(((_b = (_a = result.output) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0).toString());
|
|
65
|
+
if ([uilogic_1.OutputFormatsEnum.json, uilogic_1.OutputFormatsEnum.yaml].includes(candidate.outputFormat) === false)
|
|
66
|
+
this._ui.stopSpinner(doneMsg);
|
|
67
|
+
if (result.error)
|
|
68
|
+
throw result.error;
|
|
69
|
+
let list = (_c = result.output) !== null && _c !== void 0 ? _c : [];
|
|
70
|
+
// RENDER
|
|
71
|
+
let output = "";
|
|
72
|
+
switch (candidate.outputFormat) {
|
|
73
|
+
case uilogic_1.OutputFormatsEnum.json:
|
|
74
|
+
output = JSON.stringify(list, undefined, 2);
|
|
75
|
+
this._ui.userMessage(output);
|
|
76
|
+
break;
|
|
77
|
+
case uilogic_1.OutputFormatsEnum.yaml:
|
|
78
|
+
output = YAML.stringify(list, { indent: 2 });
|
|
79
|
+
this._ui.userMessage(output);
|
|
80
|
+
break;
|
|
81
|
+
case uilogic_1.OutputFormatsEnum.text:
|
|
82
|
+
default:
|
|
83
|
+
let listForText = list.map(r => r.name);
|
|
84
|
+
output = render.renderStringList(listForText);
|
|
85
|
+
this._ui.userMessage(output);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.default = AuthRoleList;
|
|
92
|
+
AuthRoleList.description = 'Retrieves the existing Roles within the current tenant security context.';
|
|
93
|
+
AuthRoleList.aliases = [];
|
|
94
|
+
AuthRoleList.examples = [
|
|
95
|
+
'<%= config.bin %> <%= command.id %>',
|
|
96
|
+
'<%= config.bin %> <%= command.id %> -o json',
|
|
97
|
+
'<%= config.bin %> <%= command.id %> -o yaml > roles.yaml'
|
|
98
|
+
];
|
|
99
|
+
AuthRoleList.flags = {
|
|
100
|
+
output: core_1.Flags.string({ char: 'o', default: uilogic_1.OutputFormatsEnum.text, description: "format in which to render the data.", options: [uilogic_1.OutputFormatsEnum.json, uilogic_1.OutputFormatsEnum.yaml, uilogic_1.OutputFormatsEnum.text] }),
|
|
101
|
+
// TODO: Move these into the base class
|
|
102
|
+
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.' }),
|
|
103
|
+
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.' }),
|
|
104
|
+
"to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
|
|
105
|
+
"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." })
|
|
106
|
+
};
|
|
107
|
+
AuthRoleList.args = {};
|
|
108
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/auth/role/list.ts"],"names":[],"mappings":";;;AAAA,sCAAmC;AACnC,4BAA6B;AAC7B,6BAA6B;AAG7B,0DAA0D;AAC1D,sEAAoE;AACpE,gFAA0E;AAC1E,8CAAqD;AAQrD,MAAqB,YAAa,SAAQ,gDAAqC;IAA/E;;QAsBY,cAAS,GAAG,IAAI,CAAC;IAkG7B,CAAC;IAhGc,WAAW;;;YACtB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAEvD,IAAI,OAAO,GAA4B,EAAE,CAAC;YAE1C,IAAI,KAAK,CAAC,MAAM;gBAAE,OAAO,CAAC,YAAY,GAAS,2BAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAEhF,kEAAkE;YAClE,2DAA2D;YAC3D,kEAAkE;YAElE,MAAM,eAAe,GACnB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,kCAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,MAAA,MAAA,SAAS,aAAT,SAAS,cAAT,SAAS,GAClD,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,kCAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,mCAChD,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,kCAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,mCAC5D,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,kCAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAE5D,MAAM,YAAY,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;YAG5C,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,YAAY,CAAC,CAA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GAAG;IAChB,qCAAqC;IACrC,6CAA6C;IAC7C,0DAA0D;CAC3D,CAAA;AAEM,kBAAK,GAAG;IACb,MAAM,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,2BAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,qCAAqC,EAAE,OAAO,EAAE,CAAC,2BAAiB,CAAC,IAAI,EAAE,2BAAiB,CAAC,IAAI,EAAE,2BAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;IAE3M,uCAAuC;IACvC,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,4GAA4G,EAAE,CAAC;IACtL,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,kHAAkH,EAAE,CAAC;IAC5L,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,sGAAsG,EAAE,CAAC;IAClL,eAAe,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,ycAAyc,EAAE,CAAC;CAClhB,CAAA;AAEM,iBAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InteractionModes } from '../../../uilogic/config-ui-utils';
|
|
2
|
+
import { CommandBaseExecTenant } from '../../../command-base-exec-tenant';
|
|
3
|
+
export type IAssignment = {
|
|
4
|
+
role: string;
|
|
5
|
+
user: string;
|
|
6
|
+
};
|
|
7
|
+
export default class AuthRoleUnassign extends CommandBaseExecTenant<IAssignment> {
|
|
8
|
+
static description: string;
|
|
9
|
+
static aliases: never[];
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static flags: {
|
|
12
|
+
role: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
user: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
"take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
};
|
|
19
|
+
static args: {};
|
|
20
|
+
protected adminOnly: boolean;
|
|
21
|
+
captureArgs(): Promise<[Partial<IAssignment>, InteractionModes | undefined, boolean]>;
|
|
22
|
+
buildCandidate_silently(partial: Partial<IAssignment>): Promise<IAssignment | undefined>;
|
|
23
|
+
buildCandidate_interactively(partial: Partial<IAssignment>, takeDefaults: boolean): Promise<IAssignment | undefined>;
|
|
24
|
+
buildCommandString(candidate: IAssignment, cmd: string[]): string[];
|
|
25
|
+
executeTask(candidate: IAssignment): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const _ = require("lodash");
|
|
6
|
+
const config_ui_utils_1 = require("../../../uilogic/config-ui-utils");
|
|
7
|
+
const command_base_exec_tenant_1 = require("../../../command-base-exec-tenant");
|
|
8
|
+
class AuthRoleUnassign extends command_base_exec_tenant_1.CommandBaseExecTenant {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.adminOnly = true;
|
|
12
|
+
}
|
|
13
|
+
captureArgs() {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const { args, flags } = yield this.parse(AuthRoleUnassign);
|
|
17
|
+
let partial = {};
|
|
18
|
+
if (flags.role)
|
|
19
|
+
partial.role = flags.role;
|
|
20
|
+
if (flags.user)
|
|
21
|
+
partial.user = flags.user;
|
|
22
|
+
// ---------------------------------------------------------------
|
|
23
|
+
// TODO: move everything from here down into the base class
|
|
24
|
+
// ---------------------------------------------------------------
|
|
25
|
+
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);
|
|
26
|
+
const takeDefaults = flags['take-defaults'];
|
|
27
|
+
return [partial, interactionMode, takeDefaults];
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// /** Throws on invalid */
|
|
31
|
+
// private validate(partial: Partial<IAuthRoleDef>): void {
|
|
32
|
+
// if (partial.name == undefined || _.isEmpty(partial.name)) throw new Error("Missing name");
|
|
33
|
+
// let rxName = /^[a-zA-Z][a-zA-Z0-9-]{2,50}$/;
|
|
34
|
+
// 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.");
|
|
35
|
+
// }
|
|
36
|
+
buildCandidate_silently(partial) {
|
|
37
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if (partial.role == undefined || _.isEmpty(partial.role))
|
|
39
|
+
throw new Error("Must specify role.");
|
|
40
|
+
if (partial.user == undefined || _.isEmpty(partial.user))
|
|
41
|
+
throw new Error("Must specify user.");
|
|
42
|
+
let candidate = {
|
|
43
|
+
role: partial.role,
|
|
44
|
+
user: partial.user
|
|
45
|
+
};
|
|
46
|
+
return candidate;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
buildCandidate_interactively(partial, takeDefaults) {
|
|
50
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return yield this.buildCandidate_silently(partial);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
buildCommandString(candidate, cmd) {
|
|
55
|
+
cmd.push("--role", candidate.role);
|
|
56
|
+
cmd.push("--user", candidate.user);
|
|
57
|
+
cmd.push("--silent");
|
|
58
|
+
return cmd;
|
|
59
|
+
}
|
|
60
|
+
executeTask(candidate) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
let result = yield this._codiacApi.Auth.RoleAssignment({ roleName: candidate.role, userId: candidate.user, unassign: true });
|
|
64
|
+
if (result.error)
|
|
65
|
+
throw result.error;
|
|
66
|
+
if (result.success) {
|
|
67
|
+
this._ui.userMessage(this._styler.colorGood("Success! ").concat((_a = result.message) !== null && _a !== void 0 ? _a : "Unassigned Role."));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this._ui.userMessage((_b = result.message) !== null && _b !== void 0 ? _b : "Failed to unassign role (no details given, see log for details)");
|
|
71
|
+
}
|
|
72
|
+
return;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.default = AuthRoleUnassign;
|
|
77
|
+
AuthRoleUnassign.description = 'Removes a Role from a user or group within the current tenant security context.';
|
|
78
|
+
AuthRoleUnassign.aliases = [];
|
|
79
|
+
AuthRoleUnassign.examples = [
|
|
80
|
+
'<%= config.bin %> <%= command.id %> -r deployer -u joe.cool@yourdomain.com'
|
|
81
|
+
];
|
|
82
|
+
AuthRoleUnassign.flags = {
|
|
83
|
+
role: core_1.Flags.string({ char: 'r', required: false, description: 'Name of the Role being assigned. Required in silent mode.' }),
|
|
84
|
+
user: core_1.Flags.string({ char: 'u', required: false, description: 'Username getting the role assignment. Required in silent mode.' }),
|
|
85
|
+
// TODO: Move these into the base class
|
|
86
|
+
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.' }),
|
|
87
|
+
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.' }),
|
|
88
|
+
"to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
|
|
89
|
+
"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." })
|
|
90
|
+
};
|
|
91
|
+
AuthRoleUnassign.args = {};
|
|
92
|
+
//# sourceMappingURL=unassign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unassign.js","sourceRoot":"","sources":["../../../../src/commands/auth/role/unassign.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAI5C,4BAA6B;AAK7B,sEAAoE;AAEpE,gFAA0E;AAM1E,MAAqB,gBAAiB,SAAQ,gDAAkC;IAAhF;;QAqBY,cAAS,GAAG,IAAI,CAAC;IAkF7B,CAAC;IAhFc,WAAW;;;YACtB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAE3D,IAAI,OAAO,GAAyB,EAAE,CAAC;YAEvC,IAAI,KAAK,CAAC,IAAI;gBAAE,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YAC1C,IAAI,KAAK,CAAC,IAAI;gBAAE,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YAG1C,kEAAkE;YAClE,2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,2DAA2D,EAAE,CAAC;IAC5H,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,gEAAgE,EAAE,CAAC;IAEjI,uCAAuC;IACvC,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,4GAA4G,EAAE,CAAC;IACtL,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,kHAAkH,EAAE,CAAC;IAC5L,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,sGAAsG,EAAE,CAAC;IAClL,eAAe,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,ycAAyc,EAAE,CAAC;CAClhB,CAAA;AAEM,qBAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AddTenantUserRequest } from '../../../apis/codiac-api/contracts';
|
|
2
|
+
import { CommandBaseExecTenant } from '../../../command-base-exec-tenant';
|
|
3
|
+
import { InteractionModes } from '../../../uilogic/config-ui-utils';
|
|
4
|
+
export default class AuthUserInvite extends CommandBaseExecTenant<AddTenantUserRequest> {
|
|
5
|
+
static description: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static flags: {
|
|
8
|
+
email: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
firstName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
lastName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
role: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
"take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
static args: {};
|
|
18
|
+
protected adminOnly: boolean;
|
|
19
|
+
captureArgs(): Promise<[Partial<AddTenantUserRequest>, InteractionModes | undefined, boolean]>;
|
|
20
|
+
buildCandidate_silently(partial: Partial<AddTenantUserRequest>): Promise<AddTenantUserRequest | undefined>;
|
|
21
|
+
buildCandidate_interactively(partial: Partial<AddTenantUserRequest>, takeDefaults: boolean): Promise<AddTenantUserRequest | undefined>;
|
|
22
|
+
buildCommandString(candidate: AddTenantUserRequest, cmd: string[]): string[];
|
|
23
|
+
executeTask(candidate: AddTenantUserRequest): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const _ = require("lodash");
|
|
6
|
+
const command_base_exec_tenant_1 = require("../../../command-base-exec-tenant");
|
|
7
|
+
const config_ui_utils_1 = require("../../../uilogic/config-ui-utils");
|
|
8
|
+
class AuthUserInvite extends command_base_exec_tenant_1.CommandBaseExecTenant {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.adminOnly = true;
|
|
12
|
+
}
|
|
13
|
+
captureArgs() {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const { args, flags } = yield this.parse(AuthUserInvite);
|
|
17
|
+
let partial = {};
|
|
18
|
+
if (flags.email) {
|
|
19
|
+
partial.email = flags.email;
|
|
20
|
+
partial.login = flags.email;
|
|
21
|
+
}
|
|
22
|
+
if (flags.firstName)
|
|
23
|
+
partial.firstName = flags.firstName;
|
|
24
|
+
if (flags.lastName)
|
|
25
|
+
partial.lastName = flags.lastName;
|
|
26
|
+
partial.roleNames = (_a = flags.role) !== null && _a !== void 0 ? _a : [];
|
|
27
|
+
// ---------------------------------------------------------------
|
|
28
|
+
// TODO: move everything from here down into the base class
|
|
29
|
+
// ---------------------------------------------------------------
|
|
30
|
+
const interactionMode = (this.pipedInput) ? config_ui_utils_1.InteractionModes.silent : (_c = (_b = undefined !== null && undefined !== void 0 ? undefined : (flags.echo ? config_ui_utils_1.InteractionModes.echo : undefined)) !== null && _b !== void 0 ? _b : (flags["to-script"] ? config_ui_utils_1.InteractionModes.toscript : undefined)) !== null && _c !== void 0 ? _c : (flags.silent ? config_ui_utils_1.InteractionModes.silent : undefined);
|
|
31
|
+
const takeDefaults = flags['take-defaults'];
|
|
32
|
+
return [partial, interactionMode, takeDefaults];
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
buildCandidate_silently(partial) {
|
|
36
|
+
var _a;
|
|
37
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if ((partial.email == undefined) || (partial.login == undefined))
|
|
39
|
+
throw new Error("No email provided.");
|
|
40
|
+
if ((partial.firstName == undefined) || (partial.firstName == undefined))
|
|
41
|
+
throw new Error("No firstName provided.");
|
|
42
|
+
if ((partial.lastName == undefined) || (partial.lastName == undefined))
|
|
43
|
+
throw new Error("No lastName provided.");
|
|
44
|
+
let candidate = {
|
|
45
|
+
login: partial.login,
|
|
46
|
+
email: partial.email,
|
|
47
|
+
firstName: partial.firstName,
|
|
48
|
+
lastName: partial.lastName,
|
|
49
|
+
roleNames: (_a = partial.roleNames) !== null && _a !== void 0 ? _a : []
|
|
50
|
+
};
|
|
51
|
+
return candidate;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
buildCandidate_interactively(partial, takeDefaults) {
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
return this.buildCandidate_silently(partial);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
buildCommandString(candidate, cmd) {
|
|
60
|
+
cmd.push("--email", candidate.login);
|
|
61
|
+
cmd.push("--firstName", candidate.firstName);
|
|
62
|
+
cmd.push("--lastName", candidate.lastName);
|
|
63
|
+
candidate.roleNames.forEach(r => cmd.push("-r", r));
|
|
64
|
+
cmd.push("--silent");
|
|
65
|
+
return cmd;
|
|
66
|
+
}
|
|
67
|
+
executeTask(candidate) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
try {
|
|
71
|
+
let result = yield this._codiacApi.Auth.AddTenantUser(candidate);
|
|
72
|
+
if (result.error && !_.isEmpty(result.error))
|
|
73
|
+
throw result.error;
|
|
74
|
+
if (result.success) {
|
|
75
|
+
this._ui.userMessage(this._styler.colorGood("Success! ").concat((_a = result.message) !== null && _a !== void 0 ? _a : "Invited user"));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this._ui.userMessage((_b = result.message) !== null && _b !== void 0 ? _b : "Failed to invite user (no details given, see log for details)");
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
throw err;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.default = AuthUserInvite;
|
|
89
|
+
AuthUserInvite.description = "Adds a user to the current organization. Users must be invited to an organization (*with the exception of the original creator of the organization, who gets automatically added as the administrator*). NOTE: Users are designated by their email address and can be part of multiple organizations. If the the given email is not yet registered in Codiac, the an invite email will be sent prompting the user to register with Codiac and join the current organziation. NOTE: Use the `cod auth register` to join yourself.";
|
|
90
|
+
AuthUserInvite.examples = [
|
|
91
|
+
'<%= config.bin %> <%= command.id %>',
|
|
92
|
+
];
|
|
93
|
+
AuthUserInvite.flags = {
|
|
94
|
+
email: core_1.Flags.string({ char: 'e', description: "This will be the user's login/username on Codiac." }),
|
|
95
|
+
firstName: core_1.Flags.string({ char: 'f', description: "(optional; you can edit this later)" }),
|
|
96
|
+
lastName: core_1.Flags.string({ char: 'l', description: "(optional; you can edit this later)" }),
|
|
97
|
+
role: core_1.Flags.string({ char: 'r', multiple: true, description: "Each security role to assign to the user. Use this flag multiple times, once for each role to assign." }),
|
|
98
|
+
// TODO: Move these into the base class
|
|
99
|
+
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.' }),
|
|
100
|
+
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.' }),
|
|
101
|
+
"to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
|
|
102
|
+
"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." })
|
|
103
|
+
};
|
|
104
|
+
AuthUserInvite.args = {};
|
|
105
|
+
//# sourceMappingURL=invite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invite.js","sourceRoot":"","sources":["../../../../src/commands/auth/user/invite.ts"],"names":[],"mappings":";;;AAAA,sCAAkD;AAClD,4BAA6B;AAE7B,gFAAyE;AACzE,sEAAmE;AAEnE,MAAqB,cAAe,S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E,qCAAqC,EAAE,CAAC;IACzF,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uGAAuG,EAAE,CAAC;IAEvK,uCAAuC;IACvC,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,4GAA4G,EAAE,CAAC;IACtL,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,kHAAkH,EAAE,CAAC;IAC5L,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,sGAAsG,EAAE,CAAC;IAClL,eAAe,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,ycAAyc,EAAE,CAAC;CAElhB,CAAA;AAEM,mBAAI,GAAG,EACb,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CodiacUserCriteria } from '../../../apis/codiac-api/contracts';
|
|
2
|
+
import { InteractionModes } from '../../../uilogic/config-ui-utils';
|
|
3
|
+
import { CommandBaseExecTenant } from '../../../command-base-exec-tenant';
|
|
4
|
+
import { OutputFormatsEnum } from '../../../uilogic';
|
|
5
|
+
export type ITenantUserQuery = CodiacUserCriteria & {
|
|
6
|
+
outputFormat: OutputFormatsEnum;
|
|
7
|
+
};
|
|
8
|
+
export default class AuthUserList extends CommandBaseExecTenant<ITenantUserQuery> {
|
|
9
|
+
static description: string;
|
|
10
|
+
static aliases: never[];
|
|
11
|
+
static examples: string[];
|
|
12
|
+
static flags: {
|
|
13
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
"take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
};
|
|
19
|
+
static args: {};
|
|
20
|
+
protected adminOnly: boolean;
|
|
21
|
+
captureArgs(): Promise<[Partial<ITenantUserQuery>, InteractionModes | undefined, boolean]>;
|
|
22
|
+
buildCandidate_silently(partial: Partial<ITenantUserQuery>): Promise<ITenantUserQuery | undefined>;
|
|
23
|
+
buildCandidate_interactively(partial: Partial<ITenantUserQuery>, takeDefaults: boolean): Promise<ITenantUserQuery | undefined>;
|
|
24
|
+
buildCommandString(candidate: ITenantUserQuery, cmd: string[]): string[];
|
|
25
|
+
executeTask(candidate: ITenantUserQuery): Promise<void>;
|
|
26
|
+
}
|