2024-03-05 13:11:23 +00:00

11 lines
322 B
JavaScript
Executable File

export default (req, res, next) => {
if (!req.auth) {
return res.status(401).json({ error: "No authenticated" })
}
if (!req.auth.user.roles.includes("admin")) {
return res.status(403).json({ error: "To make this request it is necessary to have administrator permissions" })
}
next()
}