|
|
|
@ -18,8 +18,9 @@ module.exports = function(privileges) {
|
|
|
|
|
// Method used in admin/category controller to show all users/groups with privs in that given cid
|
|
|
|
|
|
|
|
|
|
var privilegeLabels = [
|
|
|
|
|
{name: 'Find category'},
|
|
|
|
|
{name: 'Access & Read'},
|
|
|
|
|
{name: 'Find Category'},
|
|
|
|
|
{name: 'Access Category'},
|
|
|
|
|
{name: 'Access Topics'},
|
|
|
|
|
{name: 'Create Topics'},
|
|
|
|
|
{name: 'Reply to Topics'},
|
|
|
|
|
{name: 'Purge'},
|
|
|
|
@ -27,10 +28,10 @@ module.exports = function(privileges) {
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
var userPrivilegeList = [
|
|
|
|
|
'find', 'read', 'topics:create', 'topics:reply', 'purge', 'mods'
|
|
|
|
|
'find', 'read', 'topics:read', 'topics:create', 'topics:reply', 'purge', 'mods'
|
|
|
|
|
];
|
|
|
|
|
var groupPrivilegeList = [
|
|
|
|
|
'groups:find', 'groups:read', 'groups:topics:create', 'groups:topics:reply', 'groups:purge', 'groups:moderate'
|
|
|
|
|
'groups:find', 'groups:read', 'groups:topics:read', 'groups:topics:create', 'groups:topics:reply', 'groups:purge', 'groups:moderate'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
async.parallel({
|
|
|
|
@ -162,6 +163,9 @@ module.exports = function(privileges) {
|
|
|
|
|
'topics:create': function(next) {
|
|
|
|
|
helpers.isUserAllowedTo('topics:create', uid, [cid], next);
|
|
|
|
|
},
|
|
|
|
|
'topics:read': function(next) {
|
|
|
|
|
helpers.isUserAllowedTo('topics:read', uid, [cid], next);
|
|
|
|
|
},
|
|
|
|
|
read: function(next) {
|
|
|
|
|
helpers.isUserAllowedTo('read', uid, [cid], next);
|
|
|
|
|
},
|
|
|
|
@ -182,6 +186,7 @@ module.exports = function(privileges) {
|
|
|
|
|
cid: cid,
|
|
|
|
|
uid: uid,
|
|
|
|
|
'topics:create': results['topics:create'][0] || isAdminOrMod,
|
|
|
|
|
'topics:read': results['topics:read'][0] || isAdminOrMod,
|
|
|
|
|
editable: isAdminOrMod,
|
|
|
|
|
view_deleted: isAdminOrMod,
|
|
|
|
|
read: results.read[0] || isAdminOrMod,
|
|
|
|
@ -356,6 +361,9 @@ module.exports = function(privileges) {
|
|
|
|
|
'topics:create': function(next) {
|
|
|
|
|
groups.isMember(uid, 'cid:' + cid + ':privileges:topics:create', next);
|
|
|
|
|
},
|
|
|
|
|
'topics:read': function(next) {
|
|
|
|
|
groups.isMember(uid, 'cid:' + cid + ':privileges:topics:read', next);
|
|
|
|
|
},
|
|
|
|
|
'topics:reply': function(next) {
|
|
|
|
|
groups.isMember(uid, 'cid:' + cid + ':privileges:topics:reply', next);
|
|
|
|
|
},
|
|
|
|
@ -376,6 +384,9 @@ module.exports = function(privileges) {
|
|
|
|
|
},
|
|
|
|
|
'groups:topics:reply': function(next) {
|
|
|
|
|
groups.isMember(groupName, 'cid:' + cid + ':privileges:groups:topics:reply', next);
|
|
|
|
|
},
|
|
|
|
|
'groups:topics:read': function(next) {
|
|
|
|
|
groups.isMember(groupName, 'cid:' + cid + ':privileges:groups:topics:read', next);
|
|
|
|
|
}
|
|
|
|
|
}, callback);
|
|
|
|
|
};
|
|
|
|
|