Add support for collections with hide passwords

This commit is contained in:
hinton 2020-05-21 15:49:56 +02:00
parent 2858724f44
commit 1fa3eb49ad
8 changed files with 24 additions and 3 deletions

View File

@ -16,6 +16,7 @@ export class CipherData {
folderId: string;
userId: string;
edit: boolean;
viewPassword: boolean;
organizationUseTotp: boolean;
favorite: boolean;
revisionDate: string;
@ -43,6 +44,7 @@ export class CipherData {
this.folderId = response.folderId;
this.userId = userId;
this.edit = response.edit;
this.viewPassword = response.viewPassword;
this.organizationUseTotp = response.organizationUseTotp;
this.favorite = response.favorite;
this.revisionDate = response.revisionDate;

View File

@ -24,6 +24,7 @@ export class Cipher extends Domain {
favorite: boolean;
organizationUseTotp: boolean;
edit: boolean;
viewPassword: boolean;
revisionDate: Date;
localData: any;
login: Login;
@ -55,6 +56,7 @@ export class Cipher extends Domain {
this.favorite = obj.favorite;
this.organizationUseTotp = obj.organizationUseTotp;
this.edit = obj.edit;
this.viewPassword = obj.viewPassword;
this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
this.collectionIds = obj.collectionIds;
this.localData = localData;
@ -169,6 +171,7 @@ export class Cipher extends Domain {
c.folderId = this.folderId;
c.userId = this.organizationId != null ? userId : null;
c.edit = this.edit;
c.viewPassword = this.viewPassword;
c.organizationUseTotp = this.organizationUseTotp;
c.favorite = this.favorite;
c.revisionDate = this.revisionDate != null ? this.revisionDate.toISOString() : null;

View File

@ -11,6 +11,7 @@ export class Collection extends Domain {
name: CipherString;
externalId: string;
readOnly: boolean;
hidePasswords: boolean;
constructor(obj?: CollectionData, alreadyEncrypted: boolean = false) {
super();
@ -24,7 +25,8 @@ export class Collection extends Domain {
name: null,
externalId: null,
readOnly: null,
}, alreadyEncrypted, ['id', 'organizationId', 'externalId', 'readOnly']);
hidePasswords: null,
}, alreadyEncrypted, ['id', 'organizationId', 'externalId', 'readOnly', 'hidePasswords']);
}
decrypt(): Promise<CollectionView> {

View File

@ -1,9 +1,11 @@
export class SelectionReadOnlyRequest {
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;
}
}

View File

@ -22,6 +22,7 @@ export class CipherResponse extends BaseResponse {
secureNote: SecureNoteApi;
favorite: boolean;
edit: boolean;
viewPassword: boolean;
organizationUseTotp: boolean;
revisionDate: string;
attachments: AttachmentResponse[];
@ -38,7 +39,12 @@ export class CipherResponse extends BaseResponse {
this.name = this.getResponseProperty('Name');
this.notes = this.getResponseProperty('Notes');
this.favorite = this.getResponseProperty('Favorite') || false;
this.edit = this.getResponseProperty('Edit') || true;
this.edit = !!this.getResponseProperty('Edit');
if (this.getResponseProperty('ViewPassword') == null) {
this.viewPassword = true;
} else {
this.viewPassword = this.getResponseProperty('ViewPassword');
}
this.organizationUseTotp = this.getResponseProperty('OrganizationUseTotp');
this.revisionDate = this.getResponseProperty('RevisionDate');
this.collectionIds = this.getResponseProperty('CollectionIds');

View File

@ -3,10 +3,12 @@ import { BaseResponse } from './baseResponse';
export class SelectionReadOnlyResponse extends BaseResponse {
id: string;
readOnly: boolean;
hidePasswords: boolean;
constructor(response: any) {
super(response);
this.id = this.getResponseProperty('Id');
this.readOnly = this.getResponseProperty('ReadOnly');
this.hidePasswords = this.getResponseProperty('HidePasswords');
}
}

View File

@ -21,6 +21,7 @@ export class CipherView implements View {
favorite = false;
organizationUseTotp = false;
edit = false;
viewPassword = true;
localData: any;
login = new LoginView();
identity = new IdentityView();
@ -44,6 +45,7 @@ export class CipherView implements View {
this.favorite = c.favorite;
this.organizationUseTotp = c.organizationUseTotp;
this.edit = c.edit;
this.viewPassword = c.viewPassword;
this.type = c.type;
this.localData = c.localData;
this.collectionIds = c.collectionIds;

View File

@ -11,6 +11,7 @@ export class CollectionView implements View, ITreeNodeObject {
name: string = null;
externalId: string = null;
readOnly: boolean = null;
hidePasswords: boolean = null;
constructor(c?: Collection | CollectionGroupDetailsResponse) {
if (!c) {
@ -22,6 +23,7 @@ export class CollectionView implements View, ITreeNodeObject {
this.externalId = c.externalId;
if (c instanceof Collection) {
this.readOnly = c.readOnly;
this.hidePasswords = c.hidePasswords;
}
}
}