diff --git a/libs/importer/src/components/import.component.ts b/libs/importer/src/components/import.component.ts index baf8718eed8..bed84fe72fd 100644 --- a/libs/importer/src/components/import.component.ts +++ b/libs/importer/src/components/import.component.ts @@ -361,7 +361,7 @@ export class ImportComponent implements OnInit, OnDestroy { fileContents, this.organizationId, this.formGroup.controls.targetSelector.value, - this.isUserAdmin(this.organizationId) + this.canAccessImportExport(this.organizationId) ); //No errors, display success message @@ -386,6 +386,13 @@ export class ImportComponent implements OnInit, OnDestroy { return this.organizationService.get(this.organizationId)?.isAdmin; } + private canAccessImportExport(organizationId?: string): boolean { + if (!organizationId) { + return false; + } + return this.organizationService.get(this.organizationId)?.canAccessImportExport; + } + getFormatInstructionTitle() { if (this.format == null) { return null; diff --git a/libs/importer/src/services/import.service.abstraction.ts b/libs/importer/src/services/import.service.abstraction.ts index 1ef5df456fe..89c383f2252 100644 --- a/libs/importer/src/services/import.service.abstraction.ts +++ b/libs/importer/src/services/import.service.abstraction.ts @@ -11,7 +11,7 @@ export abstract class ImportServiceAbstraction { fileContents: string, organizationId?: string, selectedImportTarget?: string, - isUserAdmin?: boolean + canAccessImportExport?: boolean ) => Promise; getImporter: ( format: ImportType | "bitwardenpasswordprotected", diff --git a/libs/importer/src/services/import.service.ts b/libs/importer/src/services/import.service.ts index 437e51436c5..15ac802c406 100644 --- a/libs/importer/src/services/import.service.ts +++ b/libs/importer/src/services/import.service.ts @@ -111,7 +111,7 @@ export class ImportService implements ImportServiceAbstraction { fileContents: string, organizationId: string = null, selectedImportTarget: string = null, - isUserAdmin: boolean + canAccessImportExport: boolean ): Promise { let importResult: ImportResult; try { @@ -147,7 +147,11 @@ export class ImportService implements ImportServiceAbstraction { } } - if (organizationId && Utils.isNullOrWhitespace(selectedImportTarget) && !isUserAdmin) { + if ( + organizationId && + Utils.isNullOrWhitespace(selectedImportTarget) && + !canAccessImportExport + ) { const hasUnassignedCollections = importResult.ciphers.some( (c) => !Array.isArray(c.collectionIds) || c.collectionIds.length == 0 );