mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 08:12:00 +02:00
15 lines
353 B
JavaScript
15 lines
353 B
JavaScript
![]() |
const { SystemRoles } = require('librechat-data-provider');
|
||
|
|
||
|
function checkAdmin(req, res, next) {
|
||
|
try {
|
||
|
if (req.user.role !== SystemRoles.ADMIN) {
|
||
|
return res.status(403).json({ message: 'Forbidden' });
|
||
|
}
|
||
|
next();
|
||
|
} catch (error) {
|
||
|
res.status(500).json({ message: 'Internal Server Error' });
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = checkAdmin;
|