mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 04:10:01 +00:00
refactor(core): Mark all backend Enterprise Edition files and dirs (#12350)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import type { RequestHandler } from 'express';
|
||||
import { Container } from 'typedi';
|
||||
|
||||
import { isSourceControlLicensed } from '../source-control-helper.ee';
|
||||
import { SourceControlPreferencesService } from '../source-control-preferences.service.ee';
|
||||
|
||||
export const sourceControlLicensedAndEnabledMiddleware: RequestHandler = (_req, res, next) => {
|
||||
const sourceControlPreferencesService = Container.get(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' });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const sourceControlLicensedMiddleware: RequestHandler = (_req, res, next) => {
|
||||
if (isSourceControlLicensed()) {
|
||||
next();
|
||||
} else {
|
||||
res.status(401).json({ status: 'error', message: 'Unauthorized' });
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user