diff --git a/myteamwallet_frontend_modern/src/app/features/team/cashbox/cashbox.spec.ts b/myteamwallet_frontend_modern/src/app/features/team/cashbox/cashbox.spec.ts index 39d194c..d2e7063 100644 --- a/myteamwallet_frontend_modern/src/app/features/team/cashbox/cashbox.spec.ts +++ b/myteamwallet_frontend_modern/src/app/features/team/cashbox/cashbox.spec.ts @@ -306,4 +306,13 @@ describe('Cashbox', () => { ); expect(exportButton).toBeUndefined(); }); + + it('does not open the export dialogs when invoked directly without booking rights', async () => { + const { component, dialog } = await setup(1); + + component['openExportDialog'](); + component['openExportSubscriptionDialog'](); + + expect(dialog.open).not.toHaveBeenCalled(); + }); }); diff --git a/myteamwallet_frontend_modern/src/app/features/team/cashbox/cashbox.ts b/myteamwallet_frontend_modern/src/app/features/team/cashbox/cashbox.ts index 18a0947..ff4f310 100644 --- a/myteamwallet_frontend_modern/src/app/features/team/cashbox/cashbox.ts +++ b/myteamwallet_frontend_modern/src/app/features/team/cashbox/cashbox.ts @@ -402,13 +402,13 @@ export class Cashbox { protected openExportDialog(): void { const teamId = this.team()?.id; - if (!teamId) return; + if (!this.canBook() || !teamId) return; this.dialog.open(CashboxExportDialog, { data: { teamId } }); } protected openExportSubscriptionDialog(): void { const teamId = this.team()?.id; - if (!teamId) return; + if (!this.canBook() || !teamId) return; this.dialog.open(CashboxExportSubscriptionDialog, { data: { teamId } }); }