1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

updates to status command and add hidePasswords (#146)

* a few updates to the recent status addition

* add hidePasswords functionality
This commit is contained in:
Kyle Spearrin
2020-06-17 11:01:34 -04:00
committed by GitHub
parent 62c7c30cb4
commit 72c56ca506
7 changed files with 25 additions and 23 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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<Response> {
@@ -41,16 +43,12 @@ export class StatusCommand {
}
private async status(): Promise<string> {
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';
}
}