summaryrefslogtreecommitdiff
path: root/src/node/padaccess.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/node/padaccess.js')
-rw-r--r--src/node/padaccess.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/node/padaccess.js b/src/node/padaccess.js
new file mode 100644
index 00000000..a3d1df33
--- /dev/null
+++ b/src/node/padaccess.js
@@ -0,0 +1,21 @@
+var ERR = require("async-stacktrace");
+var securityManager = require('./db/SecurityManager');
+
+//checks for padAccess
+module.exports = function (req, res, callback) {
+
+ // FIXME: Why is this ever undefined??
+ if (req.cookies === undefined) req.cookies = {};
+
+ securityManager.checkAccess(req.params.pad, req.cookies.sessionid, req.cookies.token, req.cookies.password, function(err, accessObj) {
+ if(ERR(err, callback)) return;
+
+ //there is access, continue
+ if(accessObj.accessStatus == "grant") {
+ callback();
+ //no access
+ } else {
+ res.send("403 - Can't touch this", 403);
+ }
+ });
+}