mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
closes #942
This commit is contained in:
@@ -514,7 +514,7 @@ module.exports.server = server;
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/topic/:topic_id/:slug?', function (req, res) {
|
app.get('/topic/:topic_id/:slug?', function (req, res, next) {
|
||||||
var tid = req.params.topic_id;
|
var tid = req.params.topic_id;
|
||||||
|
|
||||||
if (tid.match(/^\d+\.rss$/)) {
|
if (tid.match(/^\d+\.rss$/)) {
|
||||||
@@ -531,6 +531,15 @@ module.exports.server = server;
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ThreadTools.privileges(tid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
||||||
|
if(err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!privileges.read) {
|
||||||
|
return res.redirect('403');
|
||||||
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(rssPath)) {
|
if (!fs.existsSync(rssPath)) {
|
||||||
feed.updateTopic(tid, function (err) {
|
feed.updateTopic(tid, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -542,13 +551,13 @@ module.exports.server = server;
|
|||||||
} else {
|
} else {
|
||||||
loadFeed();
|
loadFeed();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
// Check whether this user is allowed to access this topic
|
|
||||||
ThreadTools.privileges(tid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
ThreadTools.privileges(tid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (!privileges.read) {
|
if (!privileges.read) {
|
||||||
@@ -687,7 +696,7 @@ module.exports.server = server;
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/category/:category_id/:slug?', function (req, res) {
|
app.get('/category/:category_id/:slug?', function (req, res, next) {
|
||||||
var cid = req.params.category_id;
|
var cid = req.params.category_id;
|
||||||
|
|
||||||
if (cid.match(/^\d+\.rss$/)) {
|
if (cid.match(/^\d+\.rss$/)) {
|
||||||
@@ -704,6 +713,15 @@ module.exports.server = server;
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CategoryTools.privileges(cid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
||||||
|
if(err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!privileges.read) {
|
||||||
|
return res.redirect('403');
|
||||||
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(rssPath)) {
|
if (!fs.existsSync(rssPath)) {
|
||||||
feed.updateCategory(cid, function (err) {
|
feed.updateCategory(cid, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -715,13 +733,13 @@ module.exports.server = server;
|
|||||||
} else {
|
} else {
|
||||||
loadFeed();
|
loadFeed();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
// Check whether this user is allowed to access this category
|
|
||||||
CategoryTools.privileges(cid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
CategoryTools.privileges(cid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (!privileges.read) {
|
if (!privileges.read) {
|
||||||
|
|||||||
Reference in New Issue
Block a user