【发布时间】:2016-05-17 01:32:26
【问题描述】:
我第一次玩 Meteor,这个问题可能来自我对 Collections 的允许/拒绝概念缺乏理解。
我有一个登录的管理员可以访问的页面,它允许管理员修改现有用户。
为了允许使用 autoform 编辑现有用户,我大致遵循了这两个网站中列出的步骤(“允许”/“拒绝”部分除外) https://github.com/aldeed/meteor-collection2#attach-a-schema-to-meteorusers http://www.stefanhayden.com/blog/2015/05/25/user-profile-edit-with-autoform-and-simpleschema-in-meteor-js/
我最终得到了一个包含用户表的页面。 每一行都有一个编辑按钮,该按钮会导致一个编辑自动表单,使用以下代码:
{{#afModal class="btn btn-primary" collection="Meteor.users" operation="update" doc=_id}}
Edit
{{/afModal}}
这成功打开了一个编辑表单,我更改了一些用户详细信息,然后单击“更新”,我收到 Meteor 403 Access denied 错误。
这个错误我通过插入这段代码以某种方式解决了它:
Meteor.users.allow({
insert: () => true,
update: () => true,
remove: () => true
});
我的问题是,为什么我需要为“用户”明确地执行此“允许”,因为我为一个名为“战舰”的自定义集合设置了另一个类似的 CRUD 页面,它与 autoform 配合良好,无需指定这些“允许”规则?
另外请注意,我已经删除了 autopublish 和 insccure 包。
【问题讨论】:
标签: meteor crud meteor-autoform meteor-useraccounts