From dc6988762890511b57593a0646f65e580adc07d8 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 27 Jul 2018 22:36:25 -0400 Subject: [PATCH] fixes for non-admin actions on org vault list --- .../organizations/vault/ciphers.component.ts | 7 +++++++ .../vault/collections.component.ts | 8 ++++++-- .../organizations/vault/vault.component.html | 7 ++++++- src/app/vault/ciphers.component.ts | 20 +++++++++++++++---- src/app/vault/vault.component.html | 7 ++++++- 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/app/organizations/vault/ciphers.component.ts b/src/app/organizations/vault/ciphers.component.ts index 8f3561518f..bae26e3ba3 100644 --- a/src/app/organizations/vault/ciphers.component.ts +++ b/src/app/organizations/vault/ciphers.component.ts @@ -76,4 +76,11 @@ export class CiphersComponent extends BaseCiphersComponent { events(c: CipherView) { this.onEventsClicked.emit(c); } + + protected deleteCipher(id: string) { + if (!this.organization.isAdmin) { + return super.deleteCipher(id); + } + return this.apiService.deleteCipherAdmin(id); + } } diff --git a/src/app/organizations/vault/collections.component.ts b/src/app/organizations/vault/collections.component.ts index 671c45acfc..10abc41b20 100644 --- a/src/app/organizations/vault/collections.component.ts +++ b/src/app/organizations/vault/collections.component.ts @@ -51,7 +51,11 @@ export class CollectionsComponent extends BaseCollectionsComponent { } protected saveCollections() { - const request = new CipherCollectionsRequest(this.cipherDomain.collectionIds); - return this.apiService.putCipherCollectionsAdmin(this.cipherId, request); + if (this.organization.isAdmin) { + const request = new CipherCollectionsRequest(this.cipherDomain.collectionIds); + return this.apiService.putCipherCollectionsAdmin(this.cipherId, request); + } else { + return super.saveCollections(); + } } } diff --git a/src/app/organizations/vault/vault.component.html b/src/app/organizations/vault/vault.component.html index 29c8cab587..ecc138fbf4 100644 --- a/src/app/organizations/vault/vault.component.html +++ b/src/app/organizations/vault/vault.component.html @@ -7,7 +7,12 @@