padaccess: Delete useless try/catch

pull/5002/head
Richard Hansen 2021-04-12 17:30:05 -04:00
parent 329d037431
commit 951d369e3f
1 changed files with 10 additions and 15 deletions

View File

@ -3,21 +3,16 @@ const securityManager = require('./db/SecurityManager');
// checks for padAccess // checks for padAccess
module.exports = async (req, res) => { module.exports = async (req, res) => {
try { const {session: {user} = {}} = req;
const {session: {user} = {}} = req; const accessObj = await securityManager.checkAccess(
const accessObj = await securityManager.checkAccess( req.params.pad, req.cookies.sessionID, req.cookies.token, user);
req.params.pad, req.cookies.sessionID, req.cookies.token, user);
if (accessObj.accessStatus === 'grant') { if (accessObj.accessStatus === 'grant') {
// there is access, continue // there is access, continue
return true; return true;
} else { } else {
// no access // no access
res.status(403).send("403 - Can't touch this"); res.status(403).send("403 - Can't touch this");
return false; return false;
}
} catch (err) {
// @TODO - send internal server error here?
throw err;
} }
}; };