diff --git a/jslib b/jslib index 212a2e3745..28d21ca5df 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 212a2e3745e6e0e2b3057ed308c47daf6aeefbc8 +Subproject commit 28d21ca5dfacd1487cd92345d8be9554079fbd96 diff --git a/src/commands/create.command.ts b/src/commands/create.command.ts index 6dfad4973d..07000d4ede 100644 --- a/src/commands/create.command.ts +++ b/src/commands/create.command.ts @@ -149,7 +149,7 @@ export class CreateCommand { } const groups = req.groups == null ? null : - req.groups.map((g) => new SelectionReadOnlyRequest(g.id, g.readOnly)); + req.groups.map((g) => new SelectionReadOnlyRequest(g.id, g.readOnly, g.hidePasswords)); const request = new CollectionRequest(); request.name = (await this.cryptoService.encrypt(req.name, orgKey)).encryptedString; request.externalId = req.externalId; diff --git a/src/commands/edit.command.ts b/src/commands/edit.command.ts index 6c4a9f57ae..68a4e0528c 100644 --- a/src/commands/edit.command.ts +++ b/src/commands/edit.command.ts @@ -147,7 +147,7 @@ export class EditCommand { } const groups = req.groups == null ? null : - req.groups.map((g) => new SelectionReadOnlyRequest(g.id, g.readOnly)); + req.groups.map((g) => new SelectionReadOnlyRequest(g.id, g.readOnly, g.hidePasswords)); const request = new CollectionRequest(); request.name = (await this.cryptoService.encrypt(req.name, orgKey)).encryptedString; request.externalId = req.externalId; diff --git a/src/commands/get.command.ts b/src/commands/get.command.ts index 93722908bb..12b51cc3cd 100644 --- a/src/commands/get.command.ts +++ b/src/commands/get.command.ts @@ -367,7 +367,7 @@ export class GetCommand { decCollection.name = await this.cryptoService.decryptToUtf8( new CipherString(response.name), orgKey); const groups = response.groups == null ? null : - response.groups.map((g) => new SelectionReadOnly(g.id, g.readOnly)); + response.groups.map((g) => new SelectionReadOnly(g.id, g.readOnly, g.hidePasswords)); const res = new OrganizationCollectionResponse(decCollection, groups); return Response.success(res); } catch (e) { diff --git a/src/commands/status.command.ts b/src/commands/status.command.ts index 7a386c2164..1f415bcabf 100644 --- a/src/commands/status.command.ts +++ b/src/commands/status.command.ts @@ -1,15 +1,17 @@ import * as program from 'commander'; -import { EnvironmentService, SyncService, UserService, VaultTimeoutService } from 'jslib/abstractions'; +import { EnvironmentService } from 'jslib/abstractions/environment.service'; +import { SyncService } from 'jslib/abstractions/sync.service'; +import { UserService } from 'jslib/abstractions/user.service'; +import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service'; + import { Response } from 'jslib/cli/models/response'; + import { TemplateResponse } from '../models/response/templateResponse'; export class StatusCommand { - constructor( - private envService: EnvironmentService, - private syncService: SyncService, - private userService: UserService, - private vaultTimeoutService: VaultTimeoutService) { + constructor(private envService: EnvironmentService, private syncService: SyncService, + private userService: UserService, private vaultTimeoutService: VaultTimeoutService) { } async run(cmd: program.Command): Promise { @@ -41,16 +43,12 @@ export class StatusCommand { } private async status(): Promise { - const isAuthed = await this.userService.isAuthenticated(); - if (!isAuthed) { + const authed = await this.userService.isAuthenticated(); + if (!authed) { return 'unauthenticated'; } const isLocked = await this.vaultTimeoutService.isLocked(); - if (isLocked) { - return 'locked'; - } else { - return 'unlocked'; - } + return isLocked ? 'locked' : 'unlocked'; } } diff --git a/src/models/selectionReadOnly.ts b/src/models/selectionReadOnly.ts index 70d730c484..fb50841298 100644 --- a/src/models/selectionReadOnly.ts +++ b/src/models/selectionReadOnly.ts @@ -1,13 +1,15 @@ export class SelectionReadOnly { static template(): SelectionReadOnly { - return new SelectionReadOnly('00000000-0000-0000-0000-000000000000', false); + return new SelectionReadOnly('00000000-0000-0000-0000-000000000000', false, false); } id: string; readOnly: boolean; + hidePasswords: boolean; - constructor(id: string, readOnly: boolean) { + constructor(id: string, readOnly: boolean, hidePasswords: boolean) { this.id = id; this.readOnly = readOnly; + this.hidePasswords = hidePasswords || false; } } diff --git a/src/program.ts b/src/program.ts index 62ba741693..0a5392272f 100644 --- a/src/program.ts +++ b/src/program.ts @@ -699,10 +699,12 @@ export class Program extends BaseProgram { writeLn(' "status": "locked"'); writeLn(' }'); writeLn(''); - writeLn(' The "status" is one of "unauthenticated", "locked", "unlocked":'); - writeLn(' - "unauthenticated" when you are not logged in'); - writeLn(' - "locked" when you are logged in and the vault is locked'); - writeLn(' - "unlocked" when you are logged in and the vault is unlocked'); + writeLn(' Notes:'); + writeLn(''); + writeLn(' `status` is one of:'); + writeLn(' - `unauthenticated` when you are not logged in'); + writeLn(' - `locked` when you are logged in and the vault is locked'); + writeLn(' - `unlocked` when you are logged in and the vault is unlocked'); writeLn('', true); }) .action(async (cmd: program.Command) => {