mirror of
https://github.com/wassname/talk.git
synced 2026-06-28 21:47:49 +08:00
remove context
This commit is contained in:
@@ -14,7 +14,7 @@ const User = {
|
||||
|
||||
// If the user is not an admin, only return comment list for the owner of
|
||||
// the comments.
|
||||
if (user && (user.can('SEARCH_OTHERS_COMMENTS') || user.id === id)) {
|
||||
if (user && (user.can('SEARCH_OTHERS_COMMENTZ') || user.id === id)) {
|
||||
return Comments.getByQuery({author_id: id, sort: 'REVERSE_CHRONOLOGICAL'});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ UserSchema.method('verifyPassword', function(password) {
|
||||
* operation.
|
||||
*/
|
||||
UserSchema.method('can', function(...actions) {
|
||||
return can(this, null, ...actions);
|
||||
return can(this, ...actions);
|
||||
});
|
||||
|
||||
// Create the User model.
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
REMOVE_COMMENT_TAG: 'REMOVE_COMMENT_TAG',
|
||||
UPDATE_USER_ROLES: 'UPDATE_USER_ROLES',
|
||||
UPDATE_CONFIG: 'UPDATE_CONFIG',
|
||||
checkRoles: function (user, perm, context) {
|
||||
checkRoles: function (user, perm) {
|
||||
switch (perm) {
|
||||
case this.CREATE_COMMENT:
|
||||
return true;
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = {
|
||||
SEARCH_NON_NULL_OR_ACCEPTED_COMMENTS: 'SEARCH_NON_NULL_OR_ACCEPTED_COMMENTS',
|
||||
SEARCH_OTHERS_COMMENTS: 'SEARCH_OTHERS_COMMENTS',
|
||||
SEARCH_COMMENT_METRICS: 'SEARCH_COMMENT_METRICS',
|
||||
checkRoles: function (user, perm, context) {
|
||||
checkRoles: function (user, perm) {
|
||||
switch (perm) {
|
||||
case this.SEARCH_ASSETS:
|
||||
return check(user, ['ADMIN', 'MODERATOR']);
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
module.exports = {
|
||||
checkRoles: function (user, perm, context) {
|
||||
DUMMY_ROLE: 'DUMMY_ROLE',
|
||||
checkRoles: function (user, perm) {
|
||||
|
||||
// this runs before everything
|
||||
if (user.status === 'BANNED') {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (perm) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user