Orionjs - 示例博客 - 用户无法更新 post 中的任何属性
Orionjs - Example blog - users not able to update any of the attributes in the post
我正在此处试用 orionjs CMS 流星包中的 blog
示例 - https://github.com/orionjs/examples。
在示例中,社区用户能够 create/delete(他们自己的)post,但是他们无法更新 post 的任何属性。
根据 orion/roles/community.js
,用户应该能够更新除 createdBy
之外的任何属性
/**
* Users can update posts
*/
CommunityRole.allow('collections.posts.update', function(userId, doc, fields, modifier) {
return doc.createdBy === userId; // Will be allowed to edit his own posts
});
/**
* Users can't change the createdBy attribute
*/
CommunityRole.deny('collections.posts.update', function(userId, doc, fields, modifier) {
return !_.contains(fields, 'userId');
});
在 github 中也提出了同样的问题 - https://github.com/orionjs/examples/issues/16
原始代码中存在错误,已由 orion creator 修复。在orion/roles/community.js
中,这需要更改
return !_.contains(fields, 'userId');
至
return _.contains(fields, 'userId');
我正在此处试用 orionjs CMS 流星包中的 blog
示例 - https://github.com/orionjs/examples。
在示例中,社区用户能够 create/delete(他们自己的)post,但是他们无法更新 post 的任何属性。
根据 orion/roles/community.js
,用户应该能够更新除 createdBy
/**
* Users can update posts
*/
CommunityRole.allow('collections.posts.update', function(userId, doc, fields, modifier) {
return doc.createdBy === userId; // Will be allowed to edit his own posts
});
/**
* Users can't change the createdBy attribute
*/
CommunityRole.deny('collections.posts.update', function(userId, doc, fields, modifier) {
return !_.contains(fields, 'userId');
});
在 github 中也提出了同样的问题 - https://github.com/orionjs/examples/issues/16
原始代码中存在错误,已由 orion creator 修复。在orion/roles/community.js
中,这需要更改
return !_.contains(fields, 'userId');
至
return _.contains(fields, 'userId');