MCPcopy Create free account
hub / github.com/adobe/Marinus / checkAdmin

Function checkAdmin

web_server/routes/admin.js:52–63  ·  view source on GitHub ↗

* Validates the user identified in the request session is an admin. * Ends the request and returns an error if they are not. * @param {Object} req The Express request object * @param {Object} res The Express response object

(req, res)

Source from the content-addressed store, hash-verified

50 * @param {Object} res The Express response object
51 */
52function checkAdmin(req, res) {
53 if (req.session && ((req.session.groups === undefined) ||
54 (req.session.groups.indexOf('admin') === -1))) {
55 res.status(401).json({
56 'message': 'You do not appear to be an admin',
57 });
58 } else if (!req.session) {
59 res.status(401).json({
60 'message': 'You do not appear to have a session',
61 });
62 }
63}
64
65/**
66 * Validates the user identified in the request session is a data admin.

Callers 1

adminRouterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected