2016-02-02 102 views
2

我使用meteor和帳戶密碼和alanning:角色的包。 問題是當我嘗試使用角色管理員刪除或編輯其他帳戶。 我想讓用戶可以編輯。 結果總是:如何啓用Account.users可編輯或如何刪除或編輯Meteor.users()的用戶?

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) 
+0

'download'不是有效的鑰匙......有[插入,更新和刪除(https://devdocs.io/meteor/index#allow) – corvid

回答

相關問題