mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-06 09:20:43 +01:00
Use --organizationid flag for device-approval commands (#9576)
This commit is contained in:
parent
9b0250d4fd
commit
9e6fabaa39
@ -11,6 +11,10 @@ import { DenyAllCommand } from "./deny-all.command";
|
|||||||
import { DenyCommand } from "./deny.command";
|
import { DenyCommand } from "./deny.command";
|
||||||
import { ListCommand } from "./list.command";
|
import { ListCommand } from "./list.command";
|
||||||
|
|
||||||
|
type Options = {
|
||||||
|
organizationid: string;
|
||||||
|
};
|
||||||
|
|
||||||
export class DeviceApprovalProgram extends BaseProgram {
|
export class DeviceApprovalProgram extends BaseProgram {
|
||||||
constructor(protected serviceContainer: ServiceContainer) {
|
constructor(protected serviceContainer: ServiceContainer) {
|
||||||
super(serviceContainer);
|
super(serviceContainer);
|
||||||
@ -33,8 +37,8 @@ export class DeviceApprovalProgram extends BaseProgram {
|
|||||||
private listCommand(): Command {
|
private listCommand(): Command {
|
||||||
return new Command("list")
|
return new Command("list")
|
||||||
.description("List all pending requests for an organization")
|
.description("List all pending requests for an organization")
|
||||||
.argument("<organizationId>")
|
.requiredOption("--organizationid <organizationid>", "The organization id (required)")
|
||||||
.action(async (organizationId: string) => {
|
.action(async (options: Options) => {
|
||||||
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
||||||
await this.exitIfLocked();
|
await this.exitIfLocked();
|
||||||
|
|
||||||
@ -42,17 +46,18 @@ export class DeviceApprovalProgram extends BaseProgram {
|
|||||||
this.serviceContainer.organizationAuthRequestService,
|
this.serviceContainer.organizationAuthRequestService,
|
||||||
this.serviceContainer.organizationService,
|
this.serviceContainer.organizationService,
|
||||||
);
|
);
|
||||||
const response = await cmd.run(organizationId);
|
|
||||||
|
const response = await cmd.run(options.organizationid);
|
||||||
this.processResponse(response);
|
this.processResponse(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private approveCommand(): Command {
|
private approveCommand(): Command {
|
||||||
return new Command("approve")
|
return new Command("approve")
|
||||||
.argument("<organizationId>", "The id of the organization")
|
|
||||||
.argument("<requestId>", "The id of the request to approve")
|
.argument("<requestId>", "The id of the request to approve")
|
||||||
|
.requiredOption("--organizationid <organizationid>", "The organization id (required)")
|
||||||
.description("Approve a pending request")
|
.description("Approve a pending request")
|
||||||
.action(async (organizationId: string, id: string) => {
|
.action(async (id: string, options: Options) => {
|
||||||
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
||||||
await this.exitIfLocked();
|
await this.exitIfLocked();
|
||||||
|
|
||||||
@ -60,7 +65,7 @@ export class DeviceApprovalProgram extends BaseProgram {
|
|||||||
this.serviceContainer.organizationService,
|
this.serviceContainer.organizationService,
|
||||||
this.serviceContainer.organizationAuthRequestService,
|
this.serviceContainer.organizationAuthRequestService,
|
||||||
);
|
);
|
||||||
const response = await cmd.run(organizationId, id);
|
const response = await cmd.run(options.organizationid, id);
|
||||||
this.processResponse(response);
|
this.processResponse(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -68,8 +73,8 @@ export class DeviceApprovalProgram extends BaseProgram {
|
|||||||
private approveAllCommand(): Command {
|
private approveAllCommand(): Command {
|
||||||
return new Command("approve-all")
|
return new Command("approve-all")
|
||||||
.description("Approve all pending requests for an organization")
|
.description("Approve all pending requests for an organization")
|
||||||
.argument("<organizationId>")
|
.requiredOption("--organizationid <organizationid>", "The organization id (required)")
|
||||||
.action(async (organizationId: string) => {
|
.action(async (options: Options) => {
|
||||||
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
||||||
await this.exitIfLocked();
|
await this.exitIfLocked();
|
||||||
|
|
||||||
@ -77,17 +82,17 @@ export class DeviceApprovalProgram extends BaseProgram {
|
|||||||
this.serviceContainer.organizationAuthRequestService,
|
this.serviceContainer.organizationAuthRequestService,
|
||||||
this.serviceContainer.organizationService,
|
this.serviceContainer.organizationService,
|
||||||
);
|
);
|
||||||
const response = await cmd.run(organizationId);
|
const response = await cmd.run(options.organizationid);
|
||||||
this.processResponse(response);
|
this.processResponse(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private denyCommand(): Command {
|
private denyCommand(): Command {
|
||||||
return new Command("deny")
|
return new Command("deny")
|
||||||
.argument("<organizationId>", "The id of the organization")
|
|
||||||
.argument("<requestId>", "The id of the request to deny")
|
.argument("<requestId>", "The id of the request to deny")
|
||||||
|
.requiredOption("--organizationid <organizationid>", "The organization id (required)")
|
||||||
.description("Deny a pending request")
|
.description("Deny a pending request")
|
||||||
.action(async (organizationId: string, id: string) => {
|
.action(async (id: string, options: Options) => {
|
||||||
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
||||||
await this.exitIfLocked();
|
await this.exitIfLocked();
|
||||||
|
|
||||||
@ -95,7 +100,7 @@ export class DeviceApprovalProgram extends BaseProgram {
|
|||||||
this.serviceContainer.organizationService,
|
this.serviceContainer.organizationService,
|
||||||
this.serviceContainer.organizationAuthRequestService,
|
this.serviceContainer.organizationAuthRequestService,
|
||||||
);
|
);
|
||||||
const response = await cmd.run(organizationId, id);
|
const response = await cmd.run(options.organizationid, id);
|
||||||
this.processResponse(response);
|
this.processResponse(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -103,8 +108,8 @@ export class DeviceApprovalProgram extends BaseProgram {
|
|||||||
private denyAllCommand(): Command {
|
private denyAllCommand(): Command {
|
||||||
return new Command("deny-all")
|
return new Command("deny-all")
|
||||||
.description("Deny all pending requests for an organization")
|
.description("Deny all pending requests for an organization")
|
||||||
.argument("<organizationId>")
|
.requiredOption("--organizationid <organizationid>", "The organization id (required)")
|
||||||
.action(async (organizationId: string) => {
|
.action(async (options: Options) => {
|
||||||
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
await this.exitIfFeatureFlagDisabled(FeatureFlag.BulkDeviceApproval);
|
||||||
await this.exitIfLocked();
|
await this.exitIfLocked();
|
||||||
|
|
||||||
@ -112,7 +117,7 @@ export class DeviceApprovalProgram extends BaseProgram {
|
|||||||
this.serviceContainer.organizationService,
|
this.serviceContainer.organizationService,
|
||||||
this.serviceContainer.organizationAuthRequestService,
|
this.serviceContainer.organizationAuthRequestService,
|
||||||
);
|
);
|
||||||
const response = await cmd.run(organizationId);
|
const response = await cmd.run(options.organizationid);
|
||||||
this.processResponse(response);
|
this.processResponse(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user