diff --git a/src/controllers/helpers.js b/src/controllers/helpers.js index 6b91bba943..e53edae33a 100644 --- a/src/controllers/helpers.js +++ b/src/controllers/helpers.js @@ -123,6 +123,11 @@ helpers.buildTerms = function (url, term, query) { helpers.notAllowed = async function (req, res, error) { ({ error } = await plugins.hooks.fire('filter:helpers.notAllowed', { req, res, error })); + await plugins.hooks.fire('response:helpers.notAllowed', { req, res, error }); + if (res.headersSent) { + return; + } + if (req.loggedIn || req.uid === -1) { if (res.locals.isAPI) { if (req.originalUrl.startsWith(`${relative_path}/api/v3`)) {