add createCharacter, transferCharacter endpoints

This commit is contained in:
Andrew Zhu
2019-02-05 15:14:11 -08:00
parent fedda62c7c
commit c9242a95f3
2 changed files with 50 additions and 4 deletions

View File

@@ -1,3 +1,10 @@
isOwner = function(charId, userId) {
userId = userId || Meteor.userId();
var char = Characters.findOne(charId, {fields: {owner: 1}});
if (!char) return true;
return (userId === char.owner);
};
canEditCharacter = function(charId, userId){
userId = userId || Meteor.userId();
var char = Characters.findOne(charId, {fields: {owner: 1, writers: 1}});