opal-security 3.2.1 → 3.2.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 +28 -25
- package/lib/commands/login.js +8 -1
- package/lib/commands/request/create.d.ts +2 -0
- package/lib/commands/request/create.js +41 -20
- package/lib/commands/request/get.js +5 -57
- package/lib/commands/request/list.js +3 -60
- package/lib/graphql/gql.d.ts +35 -15
- package/lib/graphql/gql.js +9 -5
- package/lib/graphql/graphql.d.ts +286 -228
- package/lib/graphql/graphql.js +1674 -1095
- package/lib/labels.d.ts +3 -0
- package/lib/labels.js +37 -0
- package/lib/lib/request/api/index.d.ts +6 -0
- package/lib/lib/request/api/index.js +20 -0
- package/lib/lib/request/api/mutations/create-request.d.ts +8 -0
- package/lib/lib/request/api/mutations/create-request.js +159 -0
- package/lib/lib/request/api/queries/apps.d.ts +4 -0
- package/lib/lib/request/api/queries/apps.js +73 -0
- package/lib/lib/request/api/queries/assets.d.ts +6 -0
- package/lib/lib/request/api/queries/assets.js +136 -0
- package/lib/lib/request/api/queries/request-defaults.d.ts +5 -0
- package/lib/lib/request/api/queries/request-defaults.js +51 -0
- package/lib/lib/request/api/queries/requests.d.ts +4 -0
- package/lib/lib/request/api/queries/requests.js +163 -0
- package/lib/lib/request/api/queries/roles.d.ts +5 -0
- package/lib/lib/request/api/queries/roles.js +239 -0
- package/lib/{utils → lib/request}/displays.d.ts +4 -2
- package/lib/{utils → lib/request}/displays.js +41 -19
- package/lib/lib/request/prompts/apps-prompt.d.ts +4 -0
- package/lib/lib/request/prompts/apps-prompt.js +35 -0
- package/lib/lib/request/prompts/asset-prompt.d.ts +5 -0
- package/lib/lib/request/prompts/asset-prompt.js +81 -0
- package/lib/lib/request/prompts/duration-prompt.d.ts +2 -0
- package/lib/lib/request/prompts/duration-prompt.js +122 -0
- package/lib/lib/request/prompts/index.d.ts +8 -0
- package/lib/lib/request/prompts/index.js +20 -0
- package/lib/lib/request/prompts/reason-prompt.d.ts +2 -0
- package/lib/lib/request/prompts/reason-prompt.js +20 -0
- package/lib/lib/request/prompts/role-prompt.d.ts +4 -0
- package/lib/lib/request/prompts/role-prompt.js +44 -0
- package/lib/lib/request/prompts/validate-prompt.d.ts +4 -0
- package/lib/lib/request/prompts/validate-prompt.js +29 -0
- package/lib/lib/request/request-utils.d.ts +15 -0
- package/lib/lib/request/request-utils.js +467 -0
- package/lib/lib/request/types.d.ts +55 -0
- package/lib/lib/request/types.js +15 -0
- package/lib/lib/util.d.ts +1 -0
- package/lib/lib/util.js +16 -0
- package/lib/types.d.ts +19 -3
- package/lib/types.js +18 -2
- package/oclif.manifest.json +54 -38
- package/package.json +1 -1
- package/lib/lib/requests.d.ts +0 -54
- package/lib/lib/requests.js +0 -1160
- package/lib/utils/utils.d.ts +0 -1
- package/lib/utils/utils.js +0 -18
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.2.
|
|
25
|
+
opal-security/3.2.2 darwin-arm64 node-v18.20.4
|
|
26
26
|
$ opal --help [COMMAND]
|
|
27
27
|
USAGE
|
|
28
28
|
$ opal COMMAND
|
|
@@ -106,7 +106,7 @@ EXAMPLES
|
|
|
106
106
|
$ opal aws:identity
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
109
|
+
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/aws/identity.ts)_
|
|
110
110
|
|
|
111
111
|
## `opal clear-auth-provider`
|
|
112
112
|
|
|
@@ -126,7 +126,7 @@ EXAMPLES
|
|
|
126
126
|
$ opal clear-auth-provider
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
129
|
+
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/clear-auth-provider.ts)_
|
|
130
130
|
|
|
131
131
|
## `opal curl-example`
|
|
132
132
|
|
|
@@ -143,7 +143,7 @@ DESCRIPTION
|
|
|
143
143
|
Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
146
|
+
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/curl-example.ts)_
|
|
147
147
|
|
|
148
148
|
## `opal groups get`
|
|
149
149
|
|
|
@@ -164,7 +164,7 @@ EXAMPLES
|
|
|
164
164
|
$ opal groups:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
167
|
+
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/groups/get.ts)_
|
|
168
168
|
|
|
169
169
|
## `opal help [COMMANDS]`
|
|
170
170
|
|
|
@@ -214,7 +214,7 @@ EXAMPLES
|
|
|
214
214
|
$ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
217
|
+
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/iam-roles/start.ts)_
|
|
218
218
|
|
|
219
219
|
## `opal kube-roles start`
|
|
220
220
|
|
|
@@ -245,7 +245,7 @@ EXAMPLES
|
|
|
245
245
|
$ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
-
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
248
|
+
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/kube-roles/start.ts)_
|
|
249
249
|
|
|
250
250
|
## `opal login`
|
|
251
251
|
|
|
@@ -266,7 +266,7 @@ EXAMPLES
|
|
|
266
266
|
$ opal login
|
|
267
267
|
```
|
|
268
268
|
|
|
269
|
-
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
269
|
+
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/login.ts)_
|
|
270
270
|
|
|
271
271
|
## `opal logout`
|
|
272
272
|
|
|
@@ -286,7 +286,7 @@ EXAMPLES
|
|
|
286
286
|
$ opal logout
|
|
287
287
|
```
|
|
288
288
|
|
|
289
|
-
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
289
|
+
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/logout.ts)_
|
|
290
290
|
|
|
291
291
|
## `opal postgres-instances start`
|
|
292
292
|
|
|
@@ -324,7 +324,7 @@ EXAMPLES
|
|
|
324
324
|
$ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
|
|
325
325
|
```
|
|
326
326
|
|
|
327
|
-
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
327
|
+
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/postgres-instances/start.ts)_
|
|
328
328
|
|
|
329
329
|
## `opal request create`
|
|
330
330
|
|
|
@@ -332,26 +332,29 @@ Creates an Opal access request via an interactive form
|
|
|
332
332
|
|
|
333
333
|
```
|
|
334
334
|
USAGE
|
|
335
|
-
$ opal request create [-h] [-a <value>...] [-r <value>] [-d <value>]
|
|
335
|
+
$ opal request create [-h] [-a <value>...] [-r <value>] [-d <value>] [-t <value>] [-b <value>]
|
|
336
336
|
|
|
337
337
|
FLAGS
|
|
338
338
|
-a, --assets=<value>... The ids of the assets (resource, group) to request access to. Append a role name using a
|
|
339
339
|
colon if needed, e.g. `--assets 123:456`.
|
|
340
340
|
If not provided, an interactive selection flow will be available to select assets to request.
|
|
341
|
+
-b, --bundle=<value> A bundle ID to create a new request based on the assets in the bundle.
|
|
341
342
|
-d, --duration=<value> The duration of access for the request in minutes. Pass in a 0 value for permanent access. If
|
|
342
343
|
not provided, you will be prompted.
|
|
343
344
|
-h, --help Show CLI help.
|
|
344
345
|
-r, --reason=<value> The reason for the request, contained in quotes. If not provided, you will be prompted.
|
|
346
|
+
-t, --template=<value> A request ID of a previously finished request (cancelled/denied/approved) to create a new
|
|
347
|
+
request based on the completed request.
|
|
345
348
|
|
|
346
349
|
DESCRIPTION
|
|
347
350
|
Creates an Opal access request via an interactive form
|
|
348
351
|
```
|
|
349
352
|
|
|
350
|
-
_See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
353
|
+
_See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/request/create.ts)_
|
|
351
354
|
|
|
352
355
|
## `opal request get`
|
|
353
356
|
|
|
354
|
-
|
|
357
|
+
Fetch details of an access request by request ID
|
|
355
358
|
|
|
356
359
|
```
|
|
357
360
|
USAGE
|
|
@@ -363,7 +366,7 @@ FLAGS
|
|
|
363
366
|
-v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
|
|
364
367
|
|
|
365
368
|
DESCRIPTION
|
|
366
|
-
|
|
369
|
+
Fetch details of an access request by request ID
|
|
367
370
|
|
|
368
371
|
EXAMPLES
|
|
369
372
|
$ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
@@ -371,7 +374,7 @@ EXAMPLES
|
|
|
371
374
|
$ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose
|
|
372
375
|
```
|
|
373
376
|
|
|
374
|
-
_See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
377
|
+
_See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/request/get.ts)_
|
|
375
378
|
|
|
376
379
|
## `opal request list`
|
|
377
380
|
|
|
@@ -403,7 +406,7 @@ EXAMPLES
|
|
|
403
406
|
$ opal request list --n 5 --pending --verbose
|
|
404
407
|
```
|
|
405
408
|
|
|
406
|
-
_See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
409
|
+
_See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/request/list.ts)_
|
|
407
410
|
|
|
408
411
|
## `opal request ls`
|
|
409
412
|
|
|
@@ -454,7 +457,7 @@ EXAMPLES
|
|
|
454
457
|
$ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
455
458
|
```
|
|
456
459
|
|
|
457
|
-
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
460
|
+
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/resources/get.ts)_
|
|
458
461
|
|
|
459
462
|
## `opal set-auth-provider`
|
|
460
463
|
|
|
@@ -480,7 +483,7 @@ EXAMPLES
|
|
|
480
483
|
$ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
|
|
481
484
|
```
|
|
482
485
|
|
|
483
|
-
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
486
|
+
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-auth-provider.ts)_
|
|
484
487
|
|
|
485
488
|
## `opal set-custom-header`
|
|
486
489
|
|
|
@@ -501,7 +504,7 @@ EXAMPLES
|
|
|
501
504
|
$ opal set-custom-header --header 'cf-access-token: $TOKEN'
|
|
502
505
|
```
|
|
503
506
|
|
|
504
|
-
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
507
|
+
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-custom-header.ts)_
|
|
505
508
|
|
|
506
509
|
## `opal set-token`
|
|
507
510
|
|
|
@@ -521,7 +524,7 @@ EXAMPLES
|
|
|
521
524
|
$ opal set-token
|
|
522
525
|
```
|
|
523
526
|
|
|
524
|
-
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
527
|
+
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-token.ts)_
|
|
525
528
|
|
|
526
529
|
## `opal set-url [URL]`
|
|
527
530
|
|
|
@@ -545,7 +548,7 @@ EXAMPLES
|
|
|
545
548
|
$ opal set-url
|
|
546
549
|
```
|
|
547
550
|
|
|
548
|
-
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
551
|
+
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-url.ts)_
|
|
549
552
|
|
|
550
553
|
## `opal ssh copyFrom`
|
|
551
554
|
|
|
@@ -576,7 +579,7 @@ EXAMPLES
|
|
|
576
579
|
$ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
577
580
|
```
|
|
578
581
|
|
|
579
|
-
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
582
|
+
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/ssh/copyFrom.ts)_
|
|
580
583
|
|
|
581
584
|
## `opal ssh copyTo`
|
|
582
585
|
|
|
@@ -607,7 +610,7 @@ EXAMPLES
|
|
|
607
610
|
$ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
608
611
|
```
|
|
609
612
|
|
|
610
|
-
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
613
|
+
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/ssh/copyTo.ts)_
|
|
611
614
|
|
|
612
615
|
## `opal ssh start`
|
|
613
616
|
|
|
@@ -634,7 +637,7 @@ EXAMPLES
|
|
|
634
637
|
$ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
635
638
|
```
|
|
636
639
|
|
|
637
|
-
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
640
|
+
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/ssh/start.ts)_
|
|
638
641
|
|
|
639
642
|
## `opal version`
|
|
640
643
|
|
|
@@ -671,5 +674,5 @@ DESCRIPTION
|
|
|
671
674
|
Describes current url set, organization name, and logged in user if applicable.
|
|
672
675
|
```
|
|
673
676
|
|
|
674
|
-
_See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.
|
|
677
|
+
_See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/whoami.ts)_
|
|
675
678
|
<!-- commandsstop -->
|
package/lib/commands/login.js
CHANGED
|
@@ -218,12 +218,19 @@ class Login extends core_1.Command {
|
|
|
218
218
|
token_endpoint_auth_method: "none",
|
|
219
219
|
application_type: "native",
|
|
220
220
|
});
|
|
221
|
+
// Add the mfa:skip scope to the scopes according to appropriate org settings
|
|
222
|
+
// This scope is evaluated in Auth0 "MFA Rule" Action to skip or enabled MFA
|
|
223
|
+
let scopes = "openid email profile";
|
|
224
|
+
if (!(signInResp === null || signInResp === void 0 ? void 0 : signInResp.data.signIn.forceExtraStep)) {
|
|
225
|
+
scopes += " mfa:skip";
|
|
226
|
+
}
|
|
221
227
|
const handle = await client.deviceAuthorization({
|
|
222
228
|
audience: "https://opal.dev",
|
|
223
|
-
scope:
|
|
229
|
+
scope: scopes,
|
|
224
230
|
});
|
|
225
231
|
this.log("\nYou are being redirected to your browser to authenticate.\n");
|
|
226
232
|
this.log(` User Code: ${handle.user_code}\n`);
|
|
233
|
+
this.log("If your browser doesn't open, go to:", handle.verification_uri_complete, "\n");
|
|
227
234
|
// Wait before opening the browser window to ensure the user has time to
|
|
228
235
|
// see the User Code.
|
|
229
236
|
await (0, util_1.sleep)(1000);
|
|
@@ -6,6 +6,8 @@ export default class RequestCreate extends Command {
|
|
|
6
6
|
assets: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
7
|
reason: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
duration: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
template: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
bundle: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
11
|
};
|
|
10
12
|
run(): Promise<void>;
|
|
11
13
|
}
|
|
@@ -4,60 +4,73 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const apollo_1 = require("../../lib/apollo");
|
|
5
5
|
const cmd_1 = require("../../lib/cmd");
|
|
6
6
|
const flags_1 = require("../../lib/flags");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const displays_1 = require("../../lib/request/displays");
|
|
8
|
+
const prompts_1 = require("../../lib/request/prompts");
|
|
9
|
+
const request_utils_1 = require("../../lib/request/request-utils");
|
|
9
10
|
class RequestCreate extends core_1.Command {
|
|
10
11
|
async run() {
|
|
12
|
+
var _a;
|
|
11
13
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
12
14
|
await (0, apollo_1.initClient)(this, true);
|
|
13
15
|
const client = await (0, apollo_1.getClient)(this, true);
|
|
14
16
|
const { flags } = await this.parse(RequestCreate);
|
|
15
|
-
const metadata = (0,
|
|
17
|
+
const metadata = (0, request_utils_1.initEmptyRequestMetadata)();
|
|
18
|
+
if (flags.template) {
|
|
19
|
+
await (0, request_utils_1.duplicateRequestTemplate)(this, client, flags.template, metadata);
|
|
20
|
+
}
|
|
21
|
+
if (flags.bundle) {
|
|
22
|
+
await (0, request_utils_1.copyBundleAssets)(this, client, flags.bundle, metadata.requestMap);
|
|
23
|
+
}
|
|
16
24
|
if (flags.assets) {
|
|
17
25
|
// if IDs are provided, bypass the interactive selection process
|
|
18
|
-
await (0,
|
|
26
|
+
await (0, request_utils_1.bypassRequestSelection)(this, client, flags.assets, metadata);
|
|
19
27
|
}
|
|
20
|
-
else {
|
|
28
|
+
else if (!flags.template && !flags.bundle) {
|
|
21
29
|
(0, displays_1.headerMessage)(this);
|
|
22
30
|
let shouldProceed = false;
|
|
23
31
|
while (!shouldProceed) {
|
|
24
32
|
// Step 1: Select first round of assets from an app
|
|
25
|
-
await (0,
|
|
33
|
+
await (0, prompts_1.selectRequestableItems)(this, client, metadata.requestMap);
|
|
26
34
|
// Step 2: Display the selected items in a tree format
|
|
27
35
|
(0, displays_1.headerMessage)(this);
|
|
28
36
|
(0, displays_1.treeifyRequestMap)(this, metadata.requestMap);
|
|
29
37
|
// Step 3: Prompt to add more items, repeat 1-3 if needed
|
|
30
|
-
shouldProceed = await (0,
|
|
38
|
+
shouldProceed = await (0, prompts_1.doneSelectingAssets)();
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
// Step 4: Set Request Defaults
|
|
34
|
-
await (0,
|
|
35
|
-
// Step
|
|
42
|
+
await (0, request_utils_1.setRequestDefaults)(this, client, metadata);
|
|
43
|
+
// Step 5: Prompt for request reason
|
|
36
44
|
if (flags.reason) {
|
|
37
45
|
metadata.reason = flags.reason;
|
|
38
46
|
}
|
|
39
47
|
else if (!(metadata.requestDefaults.reasonOptional &&
|
|
40
48
|
flags.assets &&
|
|
41
|
-
flags.duration)
|
|
42
|
-
|
|
49
|
+
flags.duration) &&
|
|
50
|
+
!flags.template) {
|
|
51
|
+
await (0, prompts_1.promptForReason)(metadata);
|
|
43
52
|
}
|
|
44
|
-
// Step
|
|
53
|
+
// Step 6: Prompt for expiration
|
|
45
54
|
if (flags.duration !== undefined) {
|
|
46
|
-
(0,
|
|
55
|
+
(0, request_utils_1.bypassDuration)(this, flags.duration, metadata);
|
|
56
|
+
}
|
|
57
|
+
else if (!flags.template) {
|
|
58
|
+
await (0, prompts_1.promptForDuration)(metadata);
|
|
47
59
|
}
|
|
48
60
|
else {
|
|
49
|
-
|
|
61
|
+
(0, request_utils_1.bypassDuration)(this, (_a = metadata.durationInMinutes) !== null && _a !== void 0 ? _a : 0, metadata);
|
|
50
62
|
}
|
|
51
|
-
// Step
|
|
63
|
+
// Step 7: Display final summary of request
|
|
52
64
|
let canSubmit = true;
|
|
53
|
-
if (!(flags.assets &&
|
|
65
|
+
if (!((flags.assets || flags.bundle) &&
|
|
54
66
|
flags.duration !== undefined &&
|
|
55
|
-
(metadata.requestDefaults.reasonOptional || flags.reason))
|
|
56
|
-
|
|
67
|
+
(metadata.requestDefaults.reasonOptional || flags.reason)) &&
|
|
68
|
+
!flags.template) {
|
|
69
|
+
canSubmit = await (0, prompts_1.promptRequestSubmission)(this, metadata);
|
|
57
70
|
}
|
|
58
|
-
// Step
|
|
71
|
+
// Step 8: Prompt for final submission
|
|
59
72
|
if (canSubmit)
|
|
60
|
-
await (0,
|
|
73
|
+
await (0, request_utils_1.submitFinalRequest)(this, client, metadata);
|
|
61
74
|
}
|
|
62
75
|
}
|
|
63
76
|
RequestCreate.description = "Creates an Opal access request via an interactive form";
|
|
@@ -77,5 +90,13 @@ RequestCreate.flags = {
|
|
|
77
90
|
char: "d",
|
|
78
91
|
description: "The duration of access for the request in minutes. Pass in a 0 value for permanent access. If not provided, you will be prompted.",
|
|
79
92
|
}),
|
|
93
|
+
template: core_1.Flags.string({
|
|
94
|
+
char: "t",
|
|
95
|
+
description: "A request ID of a previously finished request (cancelled/denied/approved) to create a new request based on the completed request.",
|
|
96
|
+
}),
|
|
97
|
+
bundle: core_1.Flags.string({
|
|
98
|
+
char: "b",
|
|
99
|
+
description: "A bundle ID to create a new request based on the assets in the bundle.",
|
|
100
|
+
}),
|
|
80
101
|
};
|
|
81
102
|
exports.default = RequestCreate;
|
|
@@ -2,59 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const chalk_1 = require("chalk");
|
|
5
|
-
const graphql_1 = require("../../graphql");
|
|
6
5
|
const apollo_1 = require("../../lib/apollo");
|
|
7
6
|
const cmd_1 = require("../../lib/cmd");
|
|
8
7
|
const config_1 = require("../../lib/config");
|
|
9
8
|
const flags_1 = require("../../lib/flags");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
query GetRequest(
|
|
13
|
-
$id: RequestId!
|
|
14
|
-
) {
|
|
15
|
-
request(input: {id: $id}) {
|
|
16
|
-
__typename
|
|
17
|
-
... on RequestResult {
|
|
18
|
-
request {
|
|
19
|
-
id
|
|
20
|
-
createdAt
|
|
21
|
-
status
|
|
22
|
-
requester {
|
|
23
|
-
displayName
|
|
24
|
-
}
|
|
25
|
-
targetUser {
|
|
26
|
-
displayName
|
|
27
|
-
}
|
|
28
|
-
requestedResources {
|
|
29
|
-
resource {
|
|
30
|
-
displayName
|
|
31
|
-
id
|
|
32
|
-
}
|
|
33
|
-
accessLevel {
|
|
34
|
-
accessLevelName
|
|
35
|
-
accessLevelRemoteId
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
durationInMinutes
|
|
39
|
-
requestedGroups {
|
|
40
|
-
group {
|
|
41
|
-
id
|
|
42
|
-
name
|
|
43
|
-
}
|
|
44
|
-
accessLevel {
|
|
45
|
-
accessLevelName
|
|
46
|
-
accessLevelRemoteId
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
reason
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
... on RequestNotFoundError {
|
|
53
|
-
message
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
`);
|
|
9
|
+
const api_1 = require("../../lib/request/api");
|
|
10
|
+
const displays_1 = require("../../lib/request/displays");
|
|
58
11
|
class GetRequest extends core_1.Command {
|
|
59
12
|
async run() {
|
|
60
13
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
@@ -67,13 +20,7 @@ class GetRequest extends core_1.Command {
|
|
|
67
20
|
this.log("ex. opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4");
|
|
68
21
|
return;
|
|
69
22
|
}
|
|
70
|
-
const resp = await client.
|
|
71
|
-
query: GET_REQUEST,
|
|
72
|
-
variables: {
|
|
73
|
-
id: flags.id,
|
|
74
|
-
},
|
|
75
|
-
fetchPolicy: "network-only", // to avoid caching
|
|
76
|
-
});
|
|
23
|
+
const resp = await (0, api_1.queryRequest)(client, flags.id);
|
|
77
24
|
switch (resp.data.request.__typename) {
|
|
78
25
|
case "RequestResult": {
|
|
79
26
|
if (flags.verbose) {
|
|
@@ -84,6 +31,7 @@ class GetRequest extends core_1.Command {
|
|
|
84
31
|
}
|
|
85
32
|
const url = `${configData[config_1.urlKey]}/requests/sent/${flags.id}`;
|
|
86
33
|
this.log(`\n💡Link to request details: ${chalk_1.default.underline(url)}`);
|
|
34
|
+
(0, displays_1.displayRequestAgain)(this, flags.id);
|
|
87
35
|
return;
|
|
88
36
|
}
|
|
89
37
|
case "RequestNotFoundError":
|
|
@@ -94,7 +42,7 @@ class GetRequest extends core_1.Command {
|
|
|
94
42
|
}
|
|
95
43
|
}
|
|
96
44
|
}
|
|
97
|
-
GetRequest.description = "
|
|
45
|
+
GetRequest.description = "Fetch details of an access request by request ID";
|
|
98
46
|
GetRequest.flags = {
|
|
99
47
|
help: flags_1.SHARED_FLAGS.help,
|
|
100
48
|
id: flags_1.SHARED_FLAGS.id,
|
|
@@ -1,61 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
-
const graphql_1 = require("../../graphql");
|
|
5
4
|
const apollo_1 = require("../../lib/apollo");
|
|
6
5
|
const cmd_1 = require("../../lib/cmd");
|
|
7
6
|
const flags_1 = require("../../lib/flags");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const GET_REQUESTS = (0, graphql_1.graphql)(`
|
|
11
|
-
query GetRequests($pageSize: Int, $showPendingOnly: Boolean!) {
|
|
12
|
-
requests(input: {
|
|
13
|
-
requestType: OUTGOING
|
|
14
|
-
maxNumEntries: $pageSize
|
|
15
|
-
filters: {
|
|
16
|
-
showPendingOnly: $showPendingOnly
|
|
17
|
-
}
|
|
18
|
-
}) {
|
|
19
|
-
__typename
|
|
20
|
-
... on RequestsResult {
|
|
21
|
-
requestType
|
|
22
|
-
requests {
|
|
23
|
-
durationInMinutes
|
|
24
|
-
id
|
|
25
|
-
requester {
|
|
26
|
-
displayName
|
|
27
|
-
}
|
|
28
|
-
targetUser {
|
|
29
|
-
displayName
|
|
30
|
-
}
|
|
31
|
-
reason
|
|
32
|
-
requestedResources {
|
|
33
|
-
resource {
|
|
34
|
-
displayName
|
|
35
|
-
id
|
|
36
|
-
}
|
|
37
|
-
accessLevel {
|
|
38
|
-
accessLevelName
|
|
39
|
-
accessLevelRemoteId
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
requestedGroups {
|
|
43
|
-
group {
|
|
44
|
-
name
|
|
45
|
-
id
|
|
46
|
-
}
|
|
47
|
-
accessLevel {
|
|
48
|
-
accessLevelName
|
|
49
|
-
accessLevelRemoteId
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
status
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
}`);
|
|
7
|
+
const api_1 = require("../../lib/request/api");
|
|
8
|
+
const displays_1 = require("../../lib/request/displays");
|
|
59
9
|
class ListRequests extends core_1.Command {
|
|
60
10
|
async run() {
|
|
61
11
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
@@ -69,14 +19,7 @@ class ListRequests extends core_1.Command {
|
|
|
69
19
|
if (flags.showPendingOnly) {
|
|
70
20
|
showPendingOnly = flags.showPendingOnly;
|
|
71
21
|
}
|
|
72
|
-
const resp = await
|
|
73
|
-
query: GET_REQUESTS,
|
|
74
|
-
variables: {
|
|
75
|
-
pageSize: pageSize,
|
|
76
|
-
showPendingOnly: showPendingOnly,
|
|
77
|
-
},
|
|
78
|
-
fetchPolicy: "network-only", // to avoid caching
|
|
79
|
-
});
|
|
22
|
+
const resp = await (0, api_1.queryRequests)(client, pageSize, showPendingOnly);
|
|
80
23
|
//TODO: Make this pretty
|
|
81
24
|
if (flags.verbose) {
|
|
82
25
|
(0, apollo_1.printResponse)(this, resp);
|