Added Soft remove and a character asset parenting system

This commit is contained in:
Thaum
2015-03-18 08:59:02 +00:00
parent 06b0ad7eba
commit 3656a0b66f
24 changed files with 215 additions and 121 deletions

View File

@@ -0,0 +1,24 @@
CHARACTER_SUBSCHEMA_ALLOW = {
// the user must be logged in, and the user must be a writer of the character
insert: function (userId, doc) {
var char = Characters.findOne( doc.charId, { fields: {owner: 1, writers: 1} } );
return ( userId && char.owner === userId || _.contains(char.writers, userId) );
},
update: function (userId, doc, fields, modifier) {
var char = Characters.findOne( doc.charId, { fields: {owner: 1, writers: 1} } );
return ( userId && char.owner === userId || _.contains(char.writers, userId) );
},
remove: function (userId, doc) {
var char = Characters.findOne( doc.charId, { fields: {owner: 1, writers: 1} } );
return ( userId && char.owner === userId || _.contains(char.writers, userId) );
},
fetch: ["charId"]
};
CHARACTER_SUBSCHEMA_DENY = {
update: function (userId, docs, fields, modifier) {
// can't change character
return _.contains(fields, 'charId');
},
fetch: ["charId"]
};