mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
29 lines
485 B
JavaScript
29 lines
485 B
JavaScript
|
|
|
||
|
|
'use strict';
|
||
|
|
|
||
|
|
var async = require('async'),
|
||
|
|
|
||
|
|
user = require('../user'),
|
||
|
|
helpers = require('./helpers');
|
||
|
|
|
||
|
|
|
||
|
|
module.exports = function(privileges) {
|
||
|
|
|
||
|
|
privileges.categories = {};
|
||
|
|
|
||
|
|
privileges.categories.canRead = function(cid, uid, callback) {
|
||
|
|
helpers.some([
|
||
|
|
function(next) {
|
||
|
|
helpers.allowedTo('read', uid, cid, next);
|
||
|
|
},
|
||
|
|
function(next) {
|
||
|
|
user.isModerator(uid, cid, next);
|
||
|
|
},
|
||
|
|
function(next) {
|
||
|
|
user.isAdministrator(uid, next);
|
||
|
|
}
|
||
|
|
], callback);
|
||
|
|
};
|
||
|
|
|
||
|
|
};
|