gpt4 book ai didi

javascript - 如何启用 Account.users 可编辑或如何删除或编辑 Meteor.users() 的用户?

转载 作者:行者123 更新时间:2023-11-30 00:14:41 25 4
gpt4 key购买 nike

我使用 meteor 和 accounts-password 和 alanning:roles 包。问题是当我尝试使用管理员 Angular 色删除或编辑其他帐户时。我想让用户可以编辑。结果总是:

remove failed: Access denied. No allow validators set on restricted collection for method 'remove'.

我尝试用普通的方式让用户可以编辑,但是失败了。

Accounts.users.allow({
'insert':function(userId, doc){

return true;
},
'update': function (userId, doc) {
return true;
},
'remove': function (userId, doc) {
return true;
},
'download': function (userId, doc) {
return true;
}
});

他们的失败是:

W20160203-09:46:40.136(11)? (STDERR) C:\Users\sheng\AppData\Local\.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:245
W20160203-09:46:40.136(11)? (STDERR) throw(ex);
W20160203-09:46:40.136(11)? (STDERR) ^
W20160203-09:46:40.136(11)? (STDERR) Error: allow: Invalid key: download
W20160203-09:46:40.136(11)? (STDERR) at packages/mongo/collection.js:746:1
W20160203-09:46:40.136(11)? (STDERR) at Array.forEach (packages/es5-shim/.npm/package/node_modules/es5-shim/es5-shim.js:417:1)
W20160203-09:46:40.136(11)? (STDERR) at Function._.each._.forEach (packages/underscore/underscore.js:105:1)
W20160203-09:46:40.137(11)? (STDERR) at [object Object].addValidator (packages/mongo/collection.js:744:1)
W20160203-09:46:40.137(11)? (STDERR) at [object Object].Mongo.Collection.allow (packages/mongo/collection.js:792:1)
W20160203-09:46:40.137(11)? (STDERR) at server/permissions/permissions.js:15:14
W20160203-09:46:40.137(11)? (STDERR) at G:\work\sb-admin\.meteor\local\build\programs\server\app\server\permissions\permissions.js:41:4
W20160203-09:46:40.137(11)? (STDERR) at G:\work\sb-admin\.meteor\local\build\programs\server\boot.js:242:10
W20160203-09:46:40.137(11)? (STDERR) at Array.forEach (native)
W20160203-09:46:40.137(11)? (STDERR) at Function._.each._.forEach (C:\Users\sheng\AppData\Local\.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)

最佳答案

下载不是有效 key ,这就是您看到错误的原因。您可能认为它是一个有效的 key ,因为 CollectionFS 有它。

https://github.com/CollectionFS/Meteor-CollectionFS#security

关于javascript - 如何启用 Account.users 可编辑或如何删除或编辑 Meteor.users() 的用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35165742/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com