From 69f0339bd58855712fb02b6f1af69ef8acb491e7 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 22 Oct 2018 14:48:17 -0400 Subject: [PATCH] set collections for org admin --- jslib | 2 +- src/app/organizations/vault/add-edit.component.ts | 7 +++++++ src/app/organizations/vault/vault.component.ts | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/jslib b/jslib index c946f01b5f..3021afc9dd 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit c946f01b5fbe5b84b928ae8dd4ad54a15dd1803d +Subproject commit 3021afc9ddae1579f2226010ee487fa3edcddb0b diff --git a/src/app/organizations/vault/add-edit.component.ts b/src/app/organizations/vault/add-edit.component.ts index bd36d5a772..a8c2a1b4e5 100644 --- a/src/app/organizations/vault/add-edit.component.ts +++ b/src/app/organizations/vault/add-edit.component.ts @@ -48,6 +48,13 @@ export class AddEditComponent extends BaseAddEditComponent { await this.organizationChanged(); } + protected loadCollections() { + if (!this.organization.isAdmin) { + return super.loadCollections(); + } + return Promise.resolve(this.collections); + } + protected async loadCipher() { if (!this.organization.isAdmin) { return await super.loadCipher(); diff --git a/src/app/organizations/vault/vault.component.ts b/src/app/organizations/vault/vault.component.ts index 83ff746e2d..a64b27c93d 100644 --- a/src/app/organizations/vault/vault.component.ts +++ b/src/app/organizations/vault/vault.component.ts @@ -238,6 +238,9 @@ export class VaultComponent implements OnInit, OnDestroy { this.modal = this.cipherAddEditModalRef.createComponent(factory).instance; const childComponent = this.modal.show(AddEditComponent, this.cipherAddEditModalRef); + if (this.organization.isAdmin) { + childComponent.collections = this.groupingsComponent.collections.filter((c) => !c.readOnly); + } childComponent.organization = this.organization; childComponent.cipherId = cipher == null ? null : cipher.id; childComponent.onSavedCipher.subscribe(async (c: CipherView) => {