opal-security 3.1.1-beta.7610828 → 3.1.1-beta.9285ca4
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 +18 -18
- package/lib/commands/request/get.d.ts +1 -0
- package/lib/commands/request/get.js +10 -3
- package/lib/commands/request/list.d.ts +3 -3
- package/lib/commands/request/list.js +18 -18
- package/lib/utils/displays.js +42 -31
- package/oclif.manifest.json +22 -17
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ $ npm install -g opal-security
|
|
|
22
22
|
$ opal COMMAND
|
|
23
23
|
running command...
|
|
24
24
|
$ opal (--version)
|
|
25
|
-
opal-security/3.1.1-beta.
|
|
25
|
+
opal-security/3.1.1-beta.9285ca4 linux-x64 node-v20.19.1
|
|
26
26
|
$ opal --help [COMMAND]
|
|
27
27
|
USAGE
|
|
28
28
|
$ opal COMMAND
|
|
@@ -101,7 +101,7 @@ EXAMPLES
|
|
|
101
101
|
$ opal aws:identity
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
104
|
+
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/aws/identity.ts)_
|
|
105
105
|
|
|
106
106
|
## `opal clear-auth-provider`
|
|
107
107
|
|
|
@@ -121,7 +121,7 @@ EXAMPLES
|
|
|
121
121
|
$ opal clear-auth-provider
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
124
|
+
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/clear-auth-provider.ts)_
|
|
125
125
|
|
|
126
126
|
## `opal curl-example`
|
|
127
127
|
|
|
@@ -138,7 +138,7 @@ DESCRIPTION
|
|
|
138
138
|
Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
141
|
+
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/curl-example.ts)_
|
|
142
142
|
|
|
143
143
|
## `opal groups get`
|
|
144
144
|
|
|
@@ -159,7 +159,7 @@ EXAMPLES
|
|
|
159
159
|
$ opal groups:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
162
|
+
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/groups/get.ts)_
|
|
163
163
|
|
|
164
164
|
## `opal help [COMMANDS]`
|
|
165
165
|
|
|
@@ -209,7 +209,7 @@ EXAMPLES
|
|
|
209
209
|
$ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
212
|
+
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/iam-roles/start.ts)_
|
|
213
213
|
|
|
214
214
|
## `opal kube-roles start`
|
|
215
215
|
|
|
@@ -240,7 +240,7 @@ EXAMPLES
|
|
|
240
240
|
$ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
243
|
+
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/kube-roles/start.ts)_
|
|
244
244
|
|
|
245
245
|
## `opal login`
|
|
246
246
|
|
|
@@ -261,7 +261,7 @@ EXAMPLES
|
|
|
261
261
|
$ opal login
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
264
|
+
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/login.ts)_
|
|
265
265
|
|
|
266
266
|
## `opal logout`
|
|
267
267
|
|
|
@@ -281,7 +281,7 @@ EXAMPLES
|
|
|
281
281
|
$ opal logout
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
284
|
+
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/logout.ts)_
|
|
285
285
|
|
|
286
286
|
## `opal postgres-instances start`
|
|
287
287
|
|
|
@@ -318,7 +318,7 @@ EXAMPLES
|
|
|
318
318
|
$ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
|
|
319
319
|
```
|
|
320
320
|
|
|
321
|
-
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
321
|
+
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/postgres-instances/start.ts)_
|
|
322
322
|
|
|
323
323
|
## `opal resources get`
|
|
324
324
|
|
|
@@ -339,7 +339,7 @@ EXAMPLES
|
|
|
339
339
|
$ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
342
|
+
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/resources/get.ts)_
|
|
343
343
|
|
|
344
344
|
## `opal set-auth-provider`
|
|
345
345
|
|
|
@@ -365,7 +365,7 @@ EXAMPLES
|
|
|
365
365
|
$ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
|
|
366
366
|
```
|
|
367
367
|
|
|
368
|
-
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
368
|
+
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/set-auth-provider.ts)_
|
|
369
369
|
|
|
370
370
|
## `opal set-custom-header`
|
|
371
371
|
|
|
@@ -386,7 +386,7 @@ EXAMPLES
|
|
|
386
386
|
$ opal set-custom-header --header 'cf-access-token: $TOKEN'
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
-
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
389
|
+
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/set-custom-header.ts)_
|
|
390
390
|
|
|
391
391
|
## `opal set-token`
|
|
392
392
|
|
|
@@ -406,7 +406,7 @@ EXAMPLES
|
|
|
406
406
|
$ opal set-token
|
|
407
407
|
```
|
|
408
408
|
|
|
409
|
-
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
409
|
+
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/set-token.ts)_
|
|
410
410
|
|
|
411
411
|
## `opal set-url [URL]`
|
|
412
412
|
|
|
@@ -430,7 +430,7 @@ EXAMPLES
|
|
|
430
430
|
$ opal set-url
|
|
431
431
|
```
|
|
432
432
|
|
|
433
|
-
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
433
|
+
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/set-url.ts)_
|
|
434
434
|
|
|
435
435
|
## `opal ssh copyFrom`
|
|
436
436
|
|
|
@@ -461,7 +461,7 @@ EXAMPLES
|
|
|
461
461
|
$ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
462
462
|
```
|
|
463
463
|
|
|
464
|
-
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
464
|
+
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/ssh/copyFrom.ts)_
|
|
465
465
|
|
|
466
466
|
## `opal ssh copyTo`
|
|
467
467
|
|
|
@@ -492,7 +492,7 @@ EXAMPLES
|
|
|
492
492
|
$ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
493
493
|
```
|
|
494
494
|
|
|
495
|
-
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
495
|
+
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/ssh/copyTo.ts)_
|
|
496
496
|
|
|
497
497
|
## `opal ssh start`
|
|
498
498
|
|
|
@@ -519,7 +519,7 @@ EXAMPLES
|
|
|
519
519
|
$ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
520
520
|
```
|
|
521
521
|
|
|
522
|
-
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
522
|
+
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.9285ca4/src/commands/ssh/start.ts)_
|
|
523
523
|
|
|
524
524
|
## `opal version`
|
|
525
525
|
|
|
@@ -7,5 +7,6 @@ export default class GetRequest extends Command {
|
|
|
7
7
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
};
|
|
10
|
+
static examples: string[];
|
|
10
11
|
run(): Promise<void>;
|
|
11
12
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
+
const chalk_1 = require("chalk");
|
|
4
5
|
const graphql_1 = require("../../graphql");
|
|
5
6
|
const apollo_1 = require("../../lib/apollo");
|
|
6
7
|
const cmd_1 = require("../../lib/cmd");
|
|
@@ -76,15 +77,17 @@ class GetRequest extends core_1.Command {
|
|
|
76
77
|
fetchPolicy: "network-only", // to avoid caching
|
|
77
78
|
});
|
|
78
79
|
switch (resp.data.request.__typename) {
|
|
79
|
-
case "RequestResult":
|
|
80
|
+
case "RequestResult": {
|
|
80
81
|
if (flags.verbose) {
|
|
81
82
|
(0, apollo_1.printResponse)(this, resp);
|
|
82
83
|
}
|
|
83
84
|
else {
|
|
84
85
|
(0, displays_1.displayRequestDetails)(this, resp);
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
+
const url = `${configData[config_1.urlKey]}/requests/sent/${flags.id}`;
|
|
88
|
+
this.log(`\n💡Link to request details: ${chalk_1.default.underline(url)}`);
|
|
87
89
|
return;
|
|
90
|
+
}
|
|
88
91
|
case "RequestNotFoundError":
|
|
89
92
|
this.log(`🚫 Request with id ${flags.id} was not found`);
|
|
90
93
|
return;
|
|
@@ -100,8 +103,12 @@ GetRequest.flags = {
|
|
|
100
103
|
id: flags_1.SHARED_FLAGS.id,
|
|
101
104
|
verbose: core_1.Flags.boolean({
|
|
102
105
|
char: "v",
|
|
103
|
-
description: "Enable verbose output",
|
|
106
|
+
description: "Enable verbose output, prints full response in JSON format. Defaults to false.",
|
|
104
107
|
default: false,
|
|
105
108
|
}),
|
|
106
109
|
};
|
|
110
|
+
GetRequest.examples = [
|
|
111
|
+
"opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4",
|
|
112
|
+
"opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose",
|
|
113
|
+
];
|
|
107
114
|
exports.default = GetRequest;
|
|
@@ -2,11 +2,11 @@ import { Command } from "@oclif/core";
|
|
|
2
2
|
export default class ListRequests extends Command {
|
|
3
3
|
static hidden: boolean;
|
|
4
4
|
static description: string;
|
|
5
|
+
static examples: string[];
|
|
5
6
|
static flags: {
|
|
6
7
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
showPendingOnly: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
n: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
pending: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
};
|
|
12
12
|
run(): Promise<void>;
|
|
@@ -4,7 +4,6 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const graphql_1 = require("../../graphql");
|
|
5
5
|
const apollo_1 = require("../../lib/apollo");
|
|
6
6
|
const cmd_1 = require("../../lib/cmd");
|
|
7
|
-
const config_1 = require("../../lib/config");
|
|
8
7
|
const flags_1 = require("../../lib/flags");
|
|
9
8
|
const displays_1 = require("../../utils/displays");
|
|
10
9
|
const utils_1 = require("../../utils/utils");
|
|
@@ -62,19 +61,12 @@ class ListRequests extends core_1.Command {
|
|
|
62
61
|
async run() {
|
|
63
62
|
(0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
|
|
64
63
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
65
|
-
const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
|
|
66
64
|
const client = await (0, apollo_1.getClient)(this, true);
|
|
67
65
|
let pageSize = 10;
|
|
68
66
|
let showPendingOnly = false;
|
|
69
67
|
const { flags } = await this.parse(ListRequests);
|
|
70
|
-
if (flags.
|
|
71
|
-
|
|
72
|
-
this.error("pageSize must be greater than 0");
|
|
73
|
-
}
|
|
74
|
-
if (flags.pageSize > 100) {
|
|
75
|
-
this.error("pageSize must be less than 100");
|
|
76
|
-
}
|
|
77
|
-
pageSize = flags.pageSize;
|
|
68
|
+
if (flags.n) {
|
|
69
|
+
pageSize = flags.pageSinze;
|
|
78
70
|
}
|
|
79
71
|
if (flags.showPendingOnly) {
|
|
80
72
|
showPendingOnly = flags.showPendingOnly;
|
|
@@ -97,24 +89,32 @@ class ListRequests extends core_1.Command {
|
|
|
97
89
|
}
|
|
98
90
|
}
|
|
99
91
|
ListRequests.hidden = true;
|
|
100
|
-
ListRequests.description = "Lists your recent outgoing access requests
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
ListRequests.description = "Lists your n recent outgoing access requests";
|
|
93
|
+
ListRequests.examples = [
|
|
94
|
+
"opal request list --n 5",
|
|
95
|
+
"opal request list --n 5 --pending",
|
|
96
|
+
"opal request list --n 5 --verbose",
|
|
97
|
+
"opal request list --n 5 --pending --verbose",
|
|
98
|
+
];
|
|
103
99
|
// static aliases = ["request:ls"]; // uncomment when ready for release
|
|
104
100
|
ListRequests.flags = {
|
|
105
101
|
help: flags_1.SHARED_FLAGS.help,
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
n: core_1.Flags.integer({
|
|
103
|
+
char: "n",
|
|
108
104
|
multiple: false,
|
|
109
|
-
description: "
|
|
105
|
+
description: "Defines number of requests to be returned. 1 <= n <= 100.",
|
|
106
|
+
default: 10,
|
|
107
|
+
min: 1,
|
|
108
|
+
max: 100,
|
|
110
109
|
}),
|
|
111
|
-
|
|
110
|
+
pending: core_1.Flags.boolean({
|
|
111
|
+
char: "p",
|
|
112
112
|
description: "Show only pending requests. Defaults to false.",
|
|
113
113
|
default: false,
|
|
114
114
|
}),
|
|
115
115
|
verbose: core_1.Flags.boolean({
|
|
116
116
|
char: "v",
|
|
117
|
-
description: "Enable verbose output",
|
|
117
|
+
description: "Enable verbose output, prints full response in JSON format. Defaults to false.",
|
|
118
118
|
default: false,
|
|
119
119
|
}),
|
|
120
120
|
};
|
package/lib/utils/displays.js
CHANGED
|
@@ -6,7 +6,6 @@ exports.displayFinalRequestSummary = displayFinalRequestSummary;
|
|
|
6
6
|
exports.displayRequestDetails = displayRequestDetails;
|
|
7
7
|
exports.displayRequestList = displayRequestList;
|
|
8
8
|
const chalk_1 = require("chalk");
|
|
9
|
-
const prettyjson_1 = require("prettyjson");
|
|
10
9
|
const treeify = require("object-treeify");
|
|
11
10
|
const Table = require("cli-table3");
|
|
12
11
|
const tableStyle = {
|
|
@@ -28,7 +27,7 @@ const tableStyle = {
|
|
|
28
27
|
};
|
|
29
28
|
function headerMessage(cmd) {
|
|
30
29
|
console.clear();
|
|
31
|
-
cmd.log("
|
|
30
|
+
cmd.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
32
31
|
cmd.log("Opal Access Request ✏️");
|
|
33
32
|
cmd.log("Press Ctrl+C to cancel at any time.\n");
|
|
34
33
|
}
|
|
@@ -68,48 +67,61 @@ function displayFinalRequestSummary(cmd, requestMap, reason, expiration) {
|
|
|
68
67
|
cmd.log(table.toString());
|
|
69
68
|
}
|
|
70
69
|
function displayRequestDetails(cmd, requestResp) {
|
|
71
|
-
var _a, _b;
|
|
70
|
+
var _a, _b, _c, _d, _e, _f;
|
|
72
71
|
switch (requestResp.data.request.__typename) {
|
|
73
72
|
case "RequestResult": {
|
|
74
|
-
cmd.log(
|
|
73
|
+
cmd.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
74
|
+
cmd.log(`Request Details ${chalk_1.default.cyan(requestResp.data.request.request.id)}`);
|
|
75
|
+
cmd.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
75
76
|
const status = requestResp.data.request.request.status;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
switch (status) {
|
|
78
|
+
case "PENDING": {
|
|
79
|
+
cmd.log(`${chalk_1.default.bold("Status:")} ${chalk_1.default.blueBright(status)}`);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case "APPROVED": {
|
|
83
|
+
cmd.log(`${chalk_1.default.bold("Status:")} ${chalk_1.default.greenBright(status)}`);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case "DENIED": {
|
|
87
|
+
cmd.log(`${chalk_1.default.bold("Status:")} ${chalk_1.default.redBright(status)}`);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case "CANCELED": {
|
|
91
|
+
cmd.log(`${chalk_1.default.bold("Status:")} ${chalk_1.default.redBright(status)}`);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
89
94
|
}
|
|
90
|
-
// Request users "
|
|
95
|
+
// Request users "Requested by: <requester> -> Requested for: <targetUser>"
|
|
91
96
|
const requester = (_a = requestResp.data.request.request.requester) === null || _a === void 0 ? void 0 : _a.displayName;
|
|
92
97
|
const targetUser = (_b = requestResp.data.request.request.targetUser) === null || _b === void 0 ? void 0 : _b.displayName;
|
|
93
98
|
if (requester && targetUser) {
|
|
94
|
-
cmd.log(
|
|
99
|
+
cmd.log(`${chalk_1.default.bold("Requested by:")} ${requester} ${chalk_1.default.gray("->")} ${chalk_1.default.bold("Requested for:")} ${targetUser}`);
|
|
95
100
|
}
|
|
96
101
|
const durationInMinutes = requestResp.data.request.request.durationInMinutes;
|
|
97
102
|
if (durationInMinutes) {
|
|
98
|
-
cmd.log(
|
|
103
|
+
cmd.log(`${chalk_1.default.bold("Duration:")} ${formatDuration(durationInMinutes)}`);
|
|
99
104
|
}
|
|
100
105
|
const reason = requestResp.data.request.request.reason;
|
|
101
106
|
if (reason) {
|
|
102
|
-
cmd.log(
|
|
103
|
-
}
|
|
104
|
-
const requestedResources = requestResp.data.request.request.requestedResources;
|
|
105
|
-
const requestedGroups = requestResp.data.request.request.requestedGroups;
|
|
106
|
-
if (requestedResources && requestedResources.length > 0) {
|
|
107
|
-
cmd.log("Requested Resources:");
|
|
108
|
-
cmd.log((0, prettyjson_1.render)(requestedResources));
|
|
107
|
+
cmd.log(`${chalk_1.default.bold("Reason:")} "${chalk_1.default.italic(reason)}"`);
|
|
109
108
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
// Requested resources
|
|
110
|
+
const requestedResources = (_d = (_c = requestResp.data.request.request.requestedResources) === null || _c === void 0 ? void 0 : _c.map((resource) => {
|
|
111
|
+
var _a, _b, _c;
|
|
112
|
+
if (((_a = resource.resource) === null || _a === void 0 ? void 0 : _a.__typename) === "Resource") {
|
|
113
|
+
return formatAssetName((_b = resource.resource) === null || _b === void 0 ? void 0 : _b.displayName, ((_c = resource.accessLevel) === null || _c === void 0 ? void 0 : _c.accessLevelName) || "");
|
|
114
|
+
}
|
|
115
|
+
})) !== null && _d !== void 0 ? _d : [];
|
|
116
|
+
const requestedGroups = (_f = (_e = requestResp.data.request.request.requestedGroups) === null || _e === void 0 ? void 0 : _e.map((group) => {
|
|
117
|
+
var _a, _b, _c;
|
|
118
|
+
if (((_a = group.group) === null || _a === void 0 ? void 0 : _a.__typename) === "Group") {
|
|
119
|
+
return formatAssetName((_b = group.group) === null || _b === void 0 ? void 0 : _b.name, ((_c = group.accessLevel) === null || _c === void 0 ? void 0 : _c.accessLevelName) || "");
|
|
120
|
+
}
|
|
121
|
+
})) !== null && _f !== void 0 ? _f : [];
|
|
122
|
+
const requestedItems = [...requestedResources, ...requestedGroups].join(", ");
|
|
123
|
+
if (requestedItems) {
|
|
124
|
+
cmd.log(`${chalk_1.default.bold("Requested Items:")} ${chalk_1.default.cyan(requestedItems)}`);
|
|
113
125
|
}
|
|
114
126
|
}
|
|
115
127
|
}
|
|
@@ -142,7 +154,6 @@ function displayRequestList(cmd, requestResp) {
|
|
|
142
154
|
if (request.durationInMinutes) {
|
|
143
155
|
formattedDuration = formatDuration(request.durationInMinutes);
|
|
144
156
|
}
|
|
145
|
-
// Requested resources
|
|
146
157
|
const requestedResources = (_c = (_b = request.requestedResources) === null || _b === void 0 ? void 0 : _b.map((resource) => {
|
|
147
158
|
var _a, _b, _c;
|
|
148
159
|
if (((_a = resource.resource) === null || _a === void 0 ? void 0 : _a.__typename) === "Resource") {
|
package/oclif.manifest.json
CHANGED
|
@@ -620,6 +620,10 @@
|
|
|
620
620
|
"aliases": [],
|
|
621
621
|
"args": {},
|
|
622
622
|
"description": "Lists access requests",
|
|
623
|
+
"examples": [
|
|
624
|
+
"opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4",
|
|
625
|
+
"opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose"
|
|
626
|
+
],
|
|
623
627
|
"flags": {
|
|
624
628
|
"help": {
|
|
625
629
|
"char": "h",
|
|
@@ -638,7 +642,7 @@
|
|
|
638
642
|
},
|
|
639
643
|
"verbose": {
|
|
640
644
|
"char": "v",
|
|
641
|
-
"description": "Enable verbose output",
|
|
645
|
+
"description": "Enable verbose output, prints full response in JSON format. Defaults to false.",
|
|
642
646
|
"name": "verbose",
|
|
643
647
|
"allowNo": false,
|
|
644
648
|
"type": "boolean"
|
|
@@ -664,7 +668,13 @@
|
|
|
664
668
|
"request:list": {
|
|
665
669
|
"aliases": [],
|
|
666
670
|
"args": {},
|
|
667
|
-
"description": "Lists your recent outgoing access requests
|
|
671
|
+
"description": "Lists your n recent outgoing access requests",
|
|
672
|
+
"examples": [
|
|
673
|
+
"opal request list --n 5",
|
|
674
|
+
"opal request list --n 5 --pending",
|
|
675
|
+
"opal request list --n 5 --verbose",
|
|
676
|
+
"opal request list --n 5 --pending --verbose"
|
|
677
|
+
],
|
|
668
678
|
"flags": {
|
|
669
679
|
"help": {
|
|
670
680
|
"char": "h",
|
|
@@ -673,30 +683,25 @@
|
|
|
673
683
|
"allowNo": false,
|
|
674
684
|
"type": "boolean"
|
|
675
685
|
},
|
|
676
|
-
"
|
|
677
|
-
"char": "
|
|
678
|
-
"description": "
|
|
679
|
-
"name": "
|
|
680
|
-
"
|
|
681
|
-
"multiple": false,
|
|
682
|
-
"type": "option"
|
|
683
|
-
},
|
|
684
|
-
"pageSize": {
|
|
685
|
-
"description": "Sets number of requests to be returned. Defaults to 10 requests.",
|
|
686
|
-
"name": "pageSize",
|
|
686
|
+
"n": {
|
|
687
|
+
"char": "n",
|
|
688
|
+
"description": "Defines number of requests to be returned. 1 <= n <= 100.",
|
|
689
|
+
"name": "n",
|
|
690
|
+
"default": 10,
|
|
687
691
|
"hasDynamicHelp": false,
|
|
688
692
|
"multiple": false,
|
|
689
693
|
"type": "option"
|
|
690
694
|
},
|
|
691
|
-
"
|
|
695
|
+
"pending": {
|
|
696
|
+
"char": "p",
|
|
692
697
|
"description": "Show only pending requests. Defaults to false.",
|
|
693
|
-
"name": "
|
|
698
|
+
"name": "pending",
|
|
694
699
|
"allowNo": false,
|
|
695
700
|
"type": "boolean"
|
|
696
701
|
},
|
|
697
702
|
"verbose": {
|
|
698
703
|
"char": "v",
|
|
699
|
-
"description": "Enable verbose output",
|
|
704
|
+
"description": "Enable verbose output, prints full response in JSON format. Defaults to false.",
|
|
700
705
|
"name": "verbose",
|
|
701
706
|
"allowNo": false,
|
|
702
707
|
"type": "boolean"
|
|
@@ -966,5 +971,5 @@
|
|
|
966
971
|
]
|
|
967
972
|
}
|
|
968
973
|
},
|
|
969
|
-
"version": "3.1.1-beta.
|
|
974
|
+
"version": "3.1.1-beta.9285ca4"
|
|
970
975
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opal-security",
|
|
3
3
|
"description": "Opal allows you to centrally manage access to all of your sensitive systems.",
|
|
4
|
-
"version": "3.1.1-beta.
|
|
4
|
+
"version": "3.1.1-beta.9285ca4",
|
|
5
5
|
"author": "Stephen Cobbe",
|
|
6
6
|
"bin": {
|
|
7
7
|
"opal": "./bin/run"
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"argon2": "^0.40.1",
|
|
17
17
|
"chalk": "^2.4.2",
|
|
18
18
|
"cli-table3": "^0.6.5",
|
|
19
|
+
"enquirer": "^2.4.1",
|
|
19
20
|
"graphql": "^15.5.0",
|
|
20
21
|
"inquirer": "^8.2.6",
|
|
21
22
|
"inquirer-autocomplete-prompt": "^2.0.1",
|