fase(17): licensing module with RSA validation
This commit is contained in:
17
dist/modules/licensing/infrastructure/middleware/FeatureGateMiddleware.js
vendored
Normal file
17
dist/modules/licensing/infrastructure/middleware/FeatureGateMiddleware.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.requireFeature = requireFeature;
|
||||
function requireFeature(licenseService, feature) {
|
||||
return (_req, res, next) => {
|
||||
if (!licenseService.hasFeature(feature)) {
|
||||
res.status(403).json({
|
||||
error: 'Feature not available',
|
||||
feature,
|
||||
plan: licenseService.getCurrentLicense().plan.toString(),
|
||||
message: `This feature requires a higher license plan. Current plan: ${licenseService.getCurrentLicense().plan.toString()}`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
next();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user