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

18 lines
541 B
JavaScript
Raw Normal View History

2012-02-25 00:15:57 +01:00
var ERR = require("async-stacktrace");
var securityManager = require('./db/SecurityManager');
// checks for padAccess
2012-02-25 00:15:57 +01:00
module.exports = function (req, res, callback) {
securityManager.checkAccess(req.params.pad, req.cookies.sessionID, req.cookies.token, req.cookies.password, function(err, accessObj) {
if (ERR(err, callback)) return;
2012-02-25 00:15:57 +01:00
if (accessObj.accessStatus === "grant") {
// there is access, continue
2012-02-25 00:15:57 +01:00
callback();
} else {
// no access
res.status(403).send("403 - Can't touch this");
2012-02-25 00:15:57 +01:00
}
});
}