mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
ability to disable privilege threshold system, closes #528
This commit is contained in:
@@ -48,11 +48,15 @@ var db = require('./database'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hasEnoughRep(next) {
|
function hasEnoughRep(next) {
|
||||||
|
if (meta.config['privileges:disabled']) {
|
||||||
|
return next(null, false);
|
||||||
|
} else {
|
||||||
user.getUserField(uid, 'reputation', function(err, reputation) {
|
user.getUserField(uid, 'reputation', function(err, reputation) {
|
||||||
if (err) return next(null, false);
|
if (err) return next(null, false);
|
||||||
next(null, parseInt(reputation, 10) >= parseInt(meta.config['privileges:manage_content'], 10));
|
next(null, parseInt(reputation, 10) >= parseInt(meta.config['privileges:manage_content'], 10));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async.parallel([getThreadPrivileges, isOwnPost, hasEnoughRep], function(err, results) {
|
async.parallel([getThreadPrivileges, isOwnPost, hasEnoughRep], function(err, results) {
|
||||||
callback({
|
callback({
|
||||||
|
|||||||
@@ -33,11 +33,15 @@ var db = require('./database'),
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
hasEnoughRep: function(next) {
|
hasEnoughRep: function(next) {
|
||||||
|
if (meta.config['privileges:disabled']) {
|
||||||
|
return next(null, false);
|
||||||
|
} else {
|
||||||
user.getUserField(uid, 'reputation', function(err, reputation) {
|
user.getUserField(uid, 'reputation', function(err, reputation) {
|
||||||
if (err) return next(null, false);
|
if (err) return next(null, false);
|
||||||
next(null, parseInt(reputation, 10) >= parseInt(meta.config['privileges:manage_topic'], 10));
|
next(null, parseInt(reputation, 10) >= parseInt(meta.config['privileges:manage_topic'], 10));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, function(err, results) {
|
}, function(err, results) {
|
||||||
callback(err, !results ? undefined : {
|
callback(err, !results ? undefined : {
|
||||||
read: results.categoryPrivs.read,
|
read: results.categoryPrivs.read,
|
||||||
|
|||||||
Reference in New Issue
Block a user