【发布时间】:2016-02-02 05:52:03
【问题描述】:
删除不安全后,我无法添加新配方并收到以下错误消息 访问被拒绝 [403] cfs_base-package.js:108 但是,如果我再次添加不安全的消息,我可以再次添加食谱。你能帮我解决这个问题吗 完整源码Github
collections.js
Recipes = new Mongo.Collection('recipes');
Reviews = new Mongo.Collection('reviews');
RecipesImages = new FS.Collection("recipesImages", {
stores: [new FS.Store.GridFS("recipesImages")]
});
server/permissions.js
RecipesImages.allow({
insert: function(userId, doc) {
return true;
},
update: function(userId, doc, fieldNames, modifier) {
return true;
},
remove: function(userId, doc) {
return false;
},
download: function(userId,doc) {
return true;
},
fetch: null
});
schemas.js
Recipes.attachSchema(new SimpleSchema({
ownerId: {
type: String
},
ownerName: {
type: String
},
voters:{
type:Array,
optional:true
},
'voters.$':{
type:String
},
name: {
type: String,
label: "Recipe Name",
max: 100
},
ingredients: {
type: [Object],
minCount: 1
},
"ingredients.$.name":{
type: String
},
"ingredients.$.amount": {
type: String
},
description: {
type: String,
label: "How to prepare ",
},
time: {
type: Number,
label: "Time (Minutes)",
min:0
},
likes:{
type:Number,
optional:true
},
image: {
type: String,
autoform: {
afFieldInput: {
type: "cfs-file",
collection: 'recipesImages',
label: 'Recipe Picture'
}
}
}
}));
【问题讨论】:
标签: javascript meteor meteor-autoform