From 5db55496c2499c9ba21e1caa7bb04d393939c1a8 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 11 Jun 2018 14:32:35 -0400 Subject: [PATCH] add support for readonly flag on collections --- src/models/data/collectionData.ts | 2 ++ src/models/domain/collection.ts | 4 +++- src/models/response/collectionResponse.ts | 2 ++ src/models/view/collectionView.ts | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/models/data/collectionData.ts b/src/models/data/collectionData.ts index 3b05b9af22..ff226d315e 100644 --- a/src/models/data/collectionData.ts +++ b/src/models/data/collectionData.ts @@ -4,10 +4,12 @@ export class CollectionData { id: string; organizationId: string; name: string; + readOnly: boolean; constructor(response: CollectionResponse) { this.id = response.id; this.organizationId = response.organizationId; this.name = response.name; + this.readOnly = response.readOnly; } } diff --git a/src/models/domain/collection.ts b/src/models/domain/collection.ts index 45fd54cd8c..42886902d2 100644 --- a/src/models/domain/collection.ts +++ b/src/models/domain/collection.ts @@ -9,6 +9,7 @@ export class Collection extends Domain { id: string; organizationId: string; name: CipherString; + readOnly: boolean; constructor(obj?: CollectionData, alreadyEncrypted: boolean = false) { super(); @@ -20,7 +21,8 @@ export class Collection extends Domain { id: null, organizationId: null, name: null, - }, alreadyEncrypted, ['id', 'organizationId']); + readOnly: null, + }, alreadyEncrypted, ['id', 'organizationId', 'readOnly']); } decrypt(): Promise { diff --git a/src/models/response/collectionResponse.ts b/src/models/response/collectionResponse.ts index 77b80f57ca..525bf60e34 100644 --- a/src/models/response/collectionResponse.ts +++ b/src/models/response/collectionResponse.ts @@ -2,10 +2,12 @@ export class CollectionResponse { id: string; organizationId: string; name: string; + readOnly: boolean; constructor(response: any) { this.id = response.Id; this.organizationId = response.OrganizationId; this.name = response.Name; + this.readOnly = response.ReadOnly || false; } } diff --git a/src/models/view/collectionView.ts b/src/models/view/collectionView.ts index ab184a2c35..1c625182d4 100644 --- a/src/models/view/collectionView.ts +++ b/src/models/view/collectionView.ts @@ -6,6 +6,7 @@ export class CollectionView implements View { id: string; organizationId: string; name: string; + readOnly: boolean; constructor(c?: Collection) { if (!c) { @@ -14,5 +15,6 @@ export class CollectionView implements View { this.id = c.id; this.organizationId = c.organizationId; + this.readOnly = c.readOnly; } }