mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Permissions
This commit is contained in:
parent
fdab645c15
commit
c56c079cf2
1 changed files with 2 additions and 1 deletions
|
@ -134,8 +134,9 @@ Meteor.methods({
|
|||
|
||||
// decrement post count
|
||||
var post = Posts.findOne({_id: postId});
|
||||
Meteor.users.update({_id: post.userId}, {$inc: {postCount: -1}});
|
||||
if(!Meteor.userId() || !canEditById(Meteor.userId(), post)) throw new Meteor.Error(606, 'You need permission to edit or delete a post');
|
||||
|
||||
Meteor.users.update({_id: post.userId}, {$inc: {postCount: -1}});
|
||||
Posts.remove(postId);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue