mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 14:47:12 -04:00
remove code duplication
This commit is contained in:
parent
736aaa2800
commit
e6e81135a7
4 changed files with 33 additions and 59 deletions
|
@ -2,26 +2,8 @@ var ERR = require("async-stacktrace");
|
|||
|
||||
module.exports = function(app)
|
||||
{
|
||||
//TODO put this into module
|
||||
//checks for padAccess
|
||||
function hasPadAccess(req, res, callback)
|
||||
{
|
||||
app.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);
|
||||
}
|
||||
});
|
||||
}
|
||||
var hasPadAccess = require('./preconditions').hasPadAccess(app);
|
||||
|
||||
//handle import requests
|
||||
app.post('/p/:pad/import', function(req, res, next)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue