mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-23 15:50:54 +01:00
d5d28717c4
`getPadAccess()` (src/node/padaccess.js) is now "promise only", resolving to `true` or `false` as appropriate, and throwing an exception if there's an error. The two call sites (padreadonly.js and importexport.js) updated to match.
20 lines
568 B
JavaScript
20 lines
568 B
JavaScript
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);
|
|
|
|
if (accessObj.accessStatus === "grant") {
|
|
// there is access, continue
|
|
return true;
|
|
} else {
|
|
// no access
|
|
res.status(403).send("403 - Can't touch this");
|
|
return false;
|
|
}
|
|
} catch (err) {
|
|
// @TODO - send internal server error here?
|
|
throw err;
|
|
}
|
|
}
|