more privilege changes

v1.18.x
Julian Lam 11 years ago
parent 7c8b442dcd
commit d54ecea506

@ -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);
});
};

@ -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]]'));
}

Loading…
Cancel
Save