Removing the isUserAdmin and just using the canAccessImportExport property (#6822)
This commit is contained in:
parent
b528675cf9
commit
9c688ba55f
|
@ -361,7 +361,7 @@ export class ImportComponent implements OnInit, OnDestroy {
|
||||||
fileContents,
|
fileContents,
|
||||||
this.organizationId,
|
this.organizationId,
|
||||||
this.formGroup.controls.targetSelector.value,
|
this.formGroup.controls.targetSelector.value,
|
||||||
this.isUserAdmin(this.organizationId)
|
this.canAccessImportExport(this.organizationId)
|
||||||
);
|
);
|
||||||
|
|
||||||
//No errors, display success message
|
//No errors, display success message
|
||||||
|
@ -386,6 +386,13 @@ export class ImportComponent implements OnInit, OnDestroy {
|
||||||
return this.organizationService.get(this.organizationId)?.isAdmin;
|
return this.organizationService.get(this.organizationId)?.isAdmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private canAccessImportExport(organizationId?: string): boolean {
|
||||||
|
if (!organizationId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.organizationService.get(this.organizationId)?.canAccessImportExport;
|
||||||
|
}
|
||||||
|
|
||||||
getFormatInstructionTitle() {
|
getFormatInstructionTitle() {
|
||||||
if (this.format == null) {
|
if (this.format == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -11,7 +11,7 @@ export abstract class ImportServiceAbstraction {
|
||||||
fileContents: string,
|
fileContents: string,
|
||||||
organizationId?: string,
|
organizationId?: string,
|
||||||
selectedImportTarget?: string,
|
selectedImportTarget?: string,
|
||||||
isUserAdmin?: boolean
|
canAccessImportExport?: boolean
|
||||||
) => Promise<ImportResult>;
|
) => Promise<ImportResult>;
|
||||||
getImporter: (
|
getImporter: (
|
||||||
format: ImportType | "bitwardenpasswordprotected",
|
format: ImportType | "bitwardenpasswordprotected",
|
||||||
|
|
|
@ -111,7 +111,7 @@ export class ImportService implements ImportServiceAbstraction {
|
||||||
fileContents: string,
|
fileContents: string,
|
||||||
organizationId: string = null,
|
organizationId: string = null,
|
||||||
selectedImportTarget: string = null,
|
selectedImportTarget: string = null,
|
||||||
isUserAdmin: boolean
|
canAccessImportExport: boolean
|
||||||
): Promise<ImportResult> {
|
): Promise<ImportResult> {
|
||||||
let importResult: ImportResult;
|
let importResult: ImportResult;
|
||||||
try {
|
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(
|
const hasUnassignedCollections = importResult.ciphers.some(
|
||||||
(c) => !Array.isArray(c.collectionIds) || c.collectionIds.length == 0
|
(c) => !Array.isArray(c.collectionIds) || c.collectionIds.length == 0
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue