mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
more privilege changes
This commit is contained in:
@@ -70,8 +70,32 @@ CategoryTools.privileges = function(cid, uid, callback) {
|
|||||||
read: (
|
read: (
|
||||||
(
|
(
|
||||||
parseInt(privileges.disabled, 10) !== 1 &&
|
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.mods ||
|
||||||
privileges.admin
|
privileges.admin
|
||||||
@@ -81,6 +105,7 @@ CategoryTools.privileges = function(cid, uid, callback) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log(privileges, cid, uid);
|
||||||
callback(err, privileges || null);
|
callback(err, privileges || null);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ topicsController.get = function(req, res, next) {
|
|||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!userPrivileges.read) {
|
if (!userPrivileges.meta.read) {
|
||||||
return next(new Error('[[error:no-privileges]]'));
|
return next(new Error('[[error:no-privileges]]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user