pad.libre-service.eu-etherpad/src/node/padaccess.js

21 lines
568 B
JavaScript
Raw Normal View History

2012-02-25 00:15:57 +01:00
var securityManager = require('./db/SecurityManager');
// checks for padAccess
module.exports = async function (req, res) {
try {
let accessObj = await securityManager.checkAccess(req.params.pad, req.cookies.sessionID, req.cookies.token, req.cookies.password);
2012-02-25 00:15:57 +01:00
if (accessObj.accessStatus === "grant") {
// there is access, continue
return true;
2012-02-25 00:15:57 +01:00
} else {
// no access
res.status(403).send("403 - Can't touch this");
return false;
2012-02-25 00:15:57 +01:00
}
} catch (err) {
// @TODO - send internal server error here?
throw err;
}
2012-02-25 00:15:57 +01:00
}