mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-06-17 03:21:29 +02:00
feat(users): add fields 'isVip, isOper, isAdmin' to model user
This commit is contained in:
@@ -496,7 +496,7 @@ exports.toggleTopicTopStatus = function (req, res) {
|
||||
exports.toggleTopicGlobalStatus = function (req, res) {
|
||||
var topic = req.topic;
|
||||
|
||||
if (!req.user.toJSON().isOper && !req.user.toJSON().isAdmin) {
|
||||
if (!req.user.isOper && !req.user.isAdmin) {
|
||||
return res.status(403).json({
|
||||
message: 'ERROR: User is not authorized'
|
||||
});
|
||||
@@ -977,9 +977,9 @@ exports.topicById = function (req, res, next, id) {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function canEdit(u, f) {
|
||||
if (u.toJSON().isOper) {
|
||||
if (u.isOper) {
|
||||
return true;
|
||||
} else if (u.toJSON().isAdmin) {
|
||||
} else if (u.isAdmin) {
|
||||
return true;
|
||||
} else if (isModerator(f)) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user