1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

[PS-1841] Fix org-* commands for CLI (#4013)

* Add getFromState method

* Added a method for CLI to get an org from state

* Converted all CLI calls to `.get()`

* Used `.getFromState` instead of `.get`

* Deprecate getFromState method
This commit is contained in:
Justin Baur
2022-11-08 16:25:19 -05:00
committed by GitHub
parent 30f72825d7
commit c1b25f4389
5 changed files with 23 additions and 4 deletions

View File

@@ -436,7 +436,7 @@ export class GetCommand extends DownloadCommand {
private async getOrganization(id: string) {
let org: Organization = null;
if (Utils.isGuid(id)) {
org = await this.organizationService.get(id);
org = await this.organizationService.getFromState(id);
} else if (id.trim() !== "") {
let orgs = await this.organizationService.getAll();
orgs = CliUtils.searchOrganizations(orgs, id);

View File

@@ -23,7 +23,7 @@ export class ImportCommand {
): Promise<Response> {
const organizationId = options.organizationid;
if (organizationId != null) {
const organization = await this.organizationService.get(organizationId);
const organization = await this.organizationService.getFromState(organizationId);
if (organization == null) {
return Response.badRequest(

View File

@@ -163,7 +163,7 @@ export class ListCommand {
if (!Utils.isGuid(options.organizationId)) {
return Response.badRequest("`" + options.organizationId + "` is not a GUID.");
}
const organization = await this.organizationService.get(options.organizationId);
const organization = await this.organizationService.getFromState(options.organizationId);
if (organization == null) {
return Response.error("Organization not found.");
}
@@ -196,7 +196,7 @@ export class ListCommand {
if (!Utils.isGuid(options.organizationId)) {
return Response.badRequest("`" + options.organizationId + "` is not a GUID.");
}
const organization = await this.organizationService.get(options.organizationId);
const organization = await this.organizationService.getFromState(options.organizationId);
if (organization == null) {
return Response.error("Organization not found.");
}