remove context

This commit is contained in:
riley
2017-05-16 16:34:04 -06:00
parent 03ce044c53
commit d081c0c5b5
5 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -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
View File
@@ -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.
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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']);
+7 -1
View File
@@ -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;
}
}
};