From 6a6a47b52f2543bfac2d47d5c106174d28a7cb88 Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Thu, 9 Mar 2023 15:20:24 +0100 Subject: [PATCH] [EC-1086] The Remove individual vault Enterprise Policy prevents Service Users and Provider admins from creating new vault items via the Provider Portal. (#4909) * [EC-1086] fix: faulty orgId override When single vault policy was in effect the orgId that the user belongs to was was always set for new ciphers for new ciphers. This was overwriting the client organization's id when a provider was trying to create new items in their clients vault. * [AC-1086] chore: remove uneccessary assignments --- apps/web/src/app/vault/org-vault/vault.component.ts | 3 +-- libs/angular/src/vault/components/add-edit.component.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/vault/org-vault/vault.component.ts b/apps/web/src/app/vault/org-vault/vault.component.ts index 616d4db6e9f..37104a9a720 100644 --- a/apps/web/src/app/vault/org-vault/vault.component.ts +++ b/apps/web/src/app/vault/org-vault/vault.component.ts @@ -223,7 +223,6 @@ export class VaultComponent implements OnInit, OnDestroy { ); await this.editCipher(null, (comp) => { - comp.organizationId = this.organization.id; comp.type = this.activeFilter.cipherType; comp.collections = collections; if (this.activeFilter.collectionId) { @@ -257,6 +256,7 @@ export class VaultComponent implements OnInit, OnDestroy { const defaultComponentParameters = (comp: AddEditComponent) => { comp.organization = this.organization; + comp.organizationId = this.organization.id; comp.cipherId = cipherId; // eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe comp.onSavedCipher.subscribe(async () => { @@ -301,7 +301,6 @@ export class VaultComponent implements OnInit, OnDestroy { await this.editCipher(cipher, (comp) => { comp.cloneMode = true; comp.collections = collections; - comp.organizationId = this.organization.id; comp.collectionIds = cipher.collectionIds; }); } diff --git a/libs/angular/src/vault/components/add-edit.component.ts b/libs/angular/src/vault/components/add-edit.component.ts index eca84b661a3..b8258297cc4 100644 --- a/libs/angular/src/vault/components/add-edit.component.ts +++ b/libs/angular/src/vault/components/add-edit.component.ts @@ -201,7 +201,7 @@ export class AddEditComponent implements OnInit, OnDestroy { this.ownershipOptions.push({ name: o.name, value: o.id }); } }); - if (!this.allowPersonal) { + if (!this.allowPersonal && this.organizationId == undefined) { this.organizationId = this.defaultOwnerId; } }