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

Function checkDataAdmin

web_server/routes/admin.js:71–84  ·  view source on GitHub ↗

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

(req, res)

Source from the content-addressed store, hash-verified

69 * @param {*} res The Express response object
70 */
71function checkDataAdmin(req, res) {
72 if (req.session &&
73 (req.session.groups === undefined) ||
74 ((req.session.groups.indexOf('admin') === -1) &&
75 (req.session.groups.indexOf('data_admin') === -1))) {
76 res.status(401).json({
77 'message': 'You do not appear to have modify permissions',
78 });
79 } else if (!req.session) {
80 res.status(401).json({
81 'message': 'You do not appear to have a session',
82 });
83 }
84}
85
86/**
87 * Confirm that all parameters are a string and not an array.

Callers 1

adminRouterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected