Skip to content

Node.js based forum software built for the modern web

more privilege changes

Julian Lamd54ecea50654
diff --git a/src/categoryTools.js b/src/categoryTools.js
index 69209db0a9..c965b9b17c 100644
--- a/src/categoryTools.js
+++ b/src/categoryTools.js
@@ -70,8 +70,32 @@ CategoryTools.privileges = function(cid, uid, callback) {
read: (
(
parseInt(privileges.disabled, 10) !== 1 &&
- (privileges.read || privileges.read === null) &&
- (privileges['groups:read'] || privileges['groups:read'] === null)
+ (
+ (privileges['read'] === null && privileges['groups:read'] === null) ||
+ privileges['read'] || privileges['groups:read']
+ )
+ ) ||
+ privileges.mods ||
+ privileges.admin
+ ),
+ "topics:create": (
+ (
+ parseInt(privileges.disabled, 10) !== 1 &&
+ (
+ (privileges['topics:create'] === null && privileges['groups:topics:create'] === null) ||
+ privileges['topics:create'] || privileges['groups:topics:create']
+ )
+ ) ||
+ privileges.mods ||
+ privileges.admin
+ ),
+ "topics:reply": (
+ (
+ parseInt(privileges.disabled, 10) !== 1 &&
+ (
+ (privileges['topics:reply'] === null && privileges['groups:topics:reply'] === null) ||
+ privileges['topics:reply'] || privileges['groups:topics:reply']
+ )
) ||
privileges.mods ||
privileges.admin
@@ -81,6 +105,7 @@ CategoryTools.privileges = function(cid, uid, callback) {
};
}
+ // console.log(privileges, cid, uid);
callback(err, privileges || null);
});
};
diff --git a/src/controllers/topics.js b/src/controllers/topics.js
index 51873fdb13..b16541afc7 100644
--- a/src/controllers/topics.js
+++ b/src/controllers/topics.js
@@ -26,7 +26,7 @@ topicsController.get = function(req, res, next) {
return next(err);
}
- if (!userPrivileges.read) {
+ if (!userPrivileges.meta.read) {
return next(new Error('[[error:no-privileges]]'));
}