mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
first pass for #1518
this only handles postTools privileges, topic and category will follow
This commit is contained in:
@@ -5,6 +5,7 @@ var async = require('async'),
|
||||
|
||||
db = require('../database'),
|
||||
posts = require('../posts'),
|
||||
privileges = require('../privileges'),
|
||||
meta = require('../meta'),
|
||||
topics = require('../topics'),
|
||||
favourites = require('../favourites'),
|
||||
@@ -17,7 +18,6 @@ var async = require('async'),
|
||||
SocketPosts = {};
|
||||
|
||||
|
||||
|
||||
SocketPosts.reply = function(socket, data, callback) {
|
||||
|
||||
if (!socket.uid && !parseInt(meta.config.allowGuestPosting, 10)) {
|
||||
@@ -127,10 +127,10 @@ function sendNotificationToPostOwner(data, uid, notification) {
|
||||
SocketPosts.getRawPost = function(socket, pid, callback) {
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
postTools.privileges(pid, socket.uid, next);
|
||||
privileges.posts.canRead(pid, socket.uid, next);
|
||||
},
|
||||
function(privileges, next) {
|
||||
if (!privileges || !privileges.meta.read) {
|
||||
function(canRead, next) {
|
||||
if (!canRead) {
|
||||
return next(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
posts.getPostFields(pid, ['content', 'deleted'], next);
|
||||
@@ -205,7 +205,7 @@ function deleteOrRestore(command, socket, data, callback) {
|
||||
}
|
||||
|
||||
SocketPosts.getPrivileges = function(socket, pid, callback) {
|
||||
postTools.privileges(pid, socket.uid, function(err, privileges) {
|
||||
privileges.posts.get(pid, socket.uid, function(err, privileges) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user