first commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function timeoutLimits (metadataBackend) {
|
||||
return function timeoutLimitsMiddleware (req, res, next) {
|
||||
const { user, authorizationLevel } = res.locals;
|
||||
|
||||
metadataBackend.getUserTimeoutRenderLimits(user, function (err, timeoutRenderLimit) {
|
||||
if (req.profiler) {
|
||||
req.profiler.done('getUserTimeoutLimits');
|
||||
}
|
||||
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
const userLimits = {
|
||||
timeout: (authorizationLevel === 'master') ? timeoutRenderLimit.render : timeoutRenderLimit.renderPublic
|
||||
};
|
||||
|
||||
res.locals.userLimits = userLimits;
|
||||
|
||||
next();
|
||||
});
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user