From 5bc01ea13e1ec4742482d2ca2b524e9713b00c90 Mon Sep 17 00:00:00 2001 From: hinton Date: Thu, 21 May 2020 15:55:58 +0200 Subject: [PATCH 1/6] Add support for collections with hide passwords --- .../manage/collection-add-edit.component.ts | 2 +- .../organizations/manage/entity-users.component.html | 7 +++++++ src/app/organizations/manage/entity-users.component.ts | 4 +++- .../organizations/manage/group-add-edit.component.html | 5 +++++ .../organizations/manage/group-add-edit.component.ts | 3 ++- .../organizations/manage/user-add-edit.component.html | 5 +++++ .../organizations/manage/user-add-edit.component.ts | 3 ++- src/app/vault/add-edit.component.html | 10 ++++++---- src/app/vault/ciphers.component.html | 2 +- src/locales/en/messages.json | 3 +++ 10 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/app/organizations/manage/collection-add-edit.component.ts b/src/app/organizations/manage/collection-add-edit.component.ts index 2bf8dd1f8e..981cdbc2ce 100644 --- a/src/app/organizations/manage/collection-add-edit.component.ts +++ b/src/app/organizations/manage/collection-add-edit.component.ts @@ -113,7 +113,7 @@ export class CollectionAddEditComponent implements OnInit { request.name = (await this.cryptoService.encrypt(this.name, this.orgKey)).encryptedString; request.externalId = this.externalId; request.groups = this.groups.filter((g) => (g as any).checked && !g.accessAll) - .map((g) => new SelectionReadOnlyRequest(g.id, !!(g as any).readOnly)); + .map((g) => new SelectionReadOnlyRequest(g.id, !!(g as any).readOnly, !!(g as any).hidePasswords)); try { if (this.editMode) { diff --git a/src/app/organizations/manage/entity-users.component.html b/src/app/organizations/manage/entity-users.component.html index 79b0fb57d7..dd18b8f38e 100644 --- a/src/app/organizations/manage/entity-users.component.html +++ b/src/app/organizations/manage/entity-users.component.html @@ -47,6 +47,8 @@ {{'name' | i18n}}   {{'userType' | i18n}} + {{'hidePasswords' | + i18n}} {{'readOnly' | i18n}} @@ -85,6 +87,11 @@ {{'manager' | i18n}} {{'user' | i18n}} + + + diff --git a/src/app/organizations/manage/entity-users.component.ts b/src/app/organizations/manage/entity-users.component.ts index d67714082e..079e114b44 100644 --- a/src/app/organizations/manage/entity-users.component.ts +++ b/src/app/organizations/manage/entity-users.component.ts @@ -78,6 +78,7 @@ export class EntityUsersComponent implements OnInit { if (user != null && user.length > 0) { (user[0] as any).checked = true; (user[0] as any).readOnly = s.readOnly; + (user[0] as any).hidePasswords = s.hidePasswords; } }); } @@ -107,6 +108,7 @@ export class EntityUsersComponent implements OnInit { } else { if (this.entity === 'collection') { (u as any).readOnly = false; + (u as any).hidePasswords = false; } this.selectedCount--; } @@ -123,7 +125,7 @@ export class EntityUsersComponent implements OnInit { this.formPromise = this.apiService.putGroupUsers(this.organizationId, this.entityId, selections); } else { const selections = this.users.filter((u) => (u as any).checked && !u.accessAll) - .map((u) => new SelectionReadOnlyRequest(u.id, !!(u as any).readOnly)); + .map((u) => new SelectionReadOnlyRequest(u.id, !!(u as any).readOnly, !!(u as any).hidePasswords)); this.formPromise = this.apiService.putCollectionUsers(this.organizationId, this.entityId, selections); } await this.formPromise; diff --git a/src/app/organizations/manage/group-add-edit.component.html b/src/app/organizations/manage/group-add-edit.component.html index 4a77457fee..872bcdc023 100644 --- a/src/app/organizations/manage/group-add-edit.component.html +++ b/src/app/organizations/manage/group-add-edit.component.html @@ -59,6 +59,7 @@   {{'name' | i18n}} + {{'hidePasswords' | i18n}} {{'readOnly' | i18n}} @@ -71,6 +72,10 @@ {{c.name}} + + + diff --git a/src/app/organizations/manage/group-add-edit.component.ts b/src/app/organizations/manage/group-add-edit.component.ts index 92a03e65cc..a61898daa1 100644 --- a/src/app/organizations/manage/group-add-edit.component.ts +++ b/src/app/organizations/manage/group-add-edit.component.ts @@ -63,6 +63,7 @@ export class GroupAddEditComponent implements OnInit { if (collection != null && collection.length > 0) { (collection[0] as any).checked = true; collection[0].readOnly = s.readOnly; + collection[0].hidePasswords = s.hidePasswords; } }); } @@ -99,7 +100,7 @@ export class GroupAddEditComponent implements OnInit { request.accessAll = this.access === 'all'; if (!request.accessAll) { request.collections = this.collections.filter((c) => (c as any).checked) - .map((c) => new SelectionReadOnlyRequest(c.id, !!c.readOnly)); + .map((c) => new SelectionReadOnlyRequest(c.id, !!c.readOnly, !!c.hidePasswords)); } try { diff --git a/src/app/organizations/manage/user-add-edit.component.html b/src/app/organizations/manage/user-add-edit.component.html index da6c6c4eb0..05137ec4d9 100644 --- a/src/app/organizations/manage/user-add-edit.component.html +++ b/src/app/organizations/manage/user-add-edit.component.html @@ -94,6 +94,7 @@   {{'name' | i18n}} + {{'hidePasswords' | i18n}} {{'readOnly' | i18n}} @@ -106,6 +107,10 @@ {{c.name}} + + + diff --git a/src/app/organizations/manage/user-add-edit.component.ts b/src/app/organizations/manage/user-add-edit.component.ts index 193dba6920..34d15a890b 100644 --- a/src/app/organizations/manage/user-add-edit.component.ts +++ b/src/app/organizations/manage/user-add-edit.component.ts @@ -67,6 +67,7 @@ export class UserAddEditComponent implements OnInit { if (collection != null && collection.length > 0) { (collection[0] as any).checked = true; collection[0].readOnly = s.readOnly; + collection[0].hidePasswords = s.hidePasswords; } }); } @@ -100,7 +101,7 @@ export class UserAddEditComponent implements OnInit { let collections: SelectionReadOnlyRequest[] = null; if (this.access !== 'all') { collections = this.collections.filter((c) => (c as any).checked) - .map((c) => new SelectionReadOnlyRequest(c.id, !!c.readOnly)); + .map((c) => new SelectionReadOnlyRequest(c.id, !!c.readOnly, !!c.hidePasswords)); } try { diff --git a/src/app/vault/add-edit.component.html b/src/app/vault/add-edit.component.html index 7ea1c79d41..09d8bb65e6 100644 --- a/src/app/vault/add-edit.component.html +++ b/src/app/vault/add-edit.component.html @@ -54,7 +54,8 @@
+ appA11yTitle="{{'generatePassword' | i18n}}" (click)="generatePassword()" + *ngIf="cipher.showPassword"> + [disabled]="cipher.isDeleted || !cipher.showPassword">
diff --git a/src/app/vault/ciphers.component.html b/src/app/vault/ciphers.component.html index 32a3713979..b90938c953 100644 --- a/src/app/vault/ciphers.component.html +++ b/src/app/vault/ciphers.component.html @@ -38,7 +38,7 @@