diff --git a/packages/cli/src/environments.ee/source-control/__tests__/source-control.service.test.ts b/packages/cli/src/environments.ee/source-control/__tests__/source-control.service.test.ts index 6e84bc8776..29d151b909 100644 --- a/packages/cli/src/environments.ee/source-control/__tests__/source-control.service.test.ts +++ b/packages/cli/src/environments.ee/source-control/__tests__/source-control.service.test.ts @@ -11,6 +11,7 @@ import { InstanceSettings } from 'n8n-core'; import { SourceControlPreferencesService } from '@/environments.ee/source-control/source-control-preferences.service.ee'; import { SourceControlService } from '@/environments.ee/source-control/source-control.service.ee'; +import { ForbiddenError } from '@/errors/response-errors/forbidden.error'; import type { SourceControlImportService } from '../source-control-import.service.ee'; import type { ExportableCredential } from '../types/exportable-credential'; @@ -243,5 +244,20 @@ describe('SourceControlService', () => { expect(pullResult.find((i) => i.type === 'folders')).toHaveProperty('conflict', true); expect(pushResult.find((i) => i.type === 'folders')).toHaveProperty('conflict', false); }); + + it('should throw `ForbiddenError` if direction is pull and user is not allowed to globally pull', async () => { + // ARRANGE + const user = mock(); + user.role = 'global:member'; + + // ACT + await expect( + sourceControlService.getStatus(user, { + direction: 'pull', + verbose: false, + preferLocalVersion: false, + }), + ).rejects.toThrowError(ForbiddenError); + }); }); });