UNPKG

n8n

Version:

n8n Workflow Automation Tool

34 lines 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.sourceControlLicensedMiddleware = exports.sourceControlLicensedAndEnabledMiddleware = void 0; const typedi_1 = require("typedi"); const sourceControlHelper_ee_1 = require("../sourceControlHelper.ee"); const sourceControlPreferences_service_ee_1 = require("../sourceControlPreferences.service.ee"); const sourceControlLicensedAndEnabledMiddleware = (_req, res, next) => { const sourceControlPreferencesService = typedi_1.Container.get(sourceControlPreferences_service_ee_1.SourceControlPreferencesService); if (sourceControlPreferencesService.isSourceControlLicensedAndEnabled()) { next(); } else { if (!sourceControlPreferencesService.isSourceControlConnected()) { res.status(412).json({ status: 'error', message: 'source_control_not_connected', }); } else { res.status(401).json({ status: 'error', message: 'Unauthorized' }); } } }; exports.sourceControlLicensedAndEnabledMiddleware = sourceControlLicensedAndEnabledMiddleware; const sourceControlLicensedMiddleware = (_req, res, next) => { if ((0, sourceControlHelper_ee_1.isSourceControlLicensed)()) { next(); } else { res.status(401).json({ status: 'error', message: 'Unauthorized' }); } }; exports.sourceControlLicensedMiddleware = sourceControlLicensedMiddleware; //# sourceMappingURL=sourceControlEnabledMiddleware.ee.js.map