Angularjs 403更新Meteor用户时未经授权
当我尝试使用meteor angular更新用户的个人资料时,我得到了403分。不幸的是,它不是很具有描述性——完全的错误是:Angularjs 403更新Meteor用户时未经授权,angularjs,meteor,angular-meteor,Angularjs,Meteor,Angular Meteor,当我尝试使用meteor angular更新用户的个人资料时,我得到了403分。不幸的是,它不是很具有描述性——完全的错误是: { details: undefined error: 403 errorType: "Meteor.Error" message: "Access denied [403]" reason: "Access denied" } 我的印象是,我不需要向服务器端添加任何内容,但我添加这些内容是为了尝试了解实际的更新请求 Meteor.users.d
{
details: undefined
error: 403
errorType: "Meteor.Error"
message: "Access denied [403]"
reason: "Access denied"
}
我的印象是,我不需要向服务器端添加任何内容,但我添加这些内容是为了尝试了解实际的更新请求
Meteor.users.deny {
update: (userId, user, fields, modifier) ->
console.log("meteor deny!")
console.log(userId, user._id)
console.log(fields, modifier)
false
}
Meteor.users.allow {
update: (userId, user, fields, modifier) ->
console.log("allow", arguments)
true
}
用于调试。在日志中,我看到了
I20150707-22:14:22.955(-6)?流星否认I20150707-22:14:22.956(-6)?HK83P9HIEEBYHZO6 HK83P9HIEEBYHZO6
I20150707-22:14:22.956(-6)?['profile']{'$set':{'profile.name':'ben','profile.gender':'male'} 这正是我希望看到的,并且似乎是查看文档时需要的——即,用户正在编辑自己的配置文件,而$set使用点符号。我从客户端触发更新,基本上是使用非常简单的角度。有趣的是
....
$scope.user = $meteor.object $meteor.getCollectionByName("users"), $stateParams.userId
$scope.save = () ->
if $scope.form.$valid
$scope.user.save({ 'profile.name': $scope.user.profile.name, 'profile.gender': $scope.user.profile.gender}).then(
(numberOfDocs) ->
console.log 'save successful, docs affected ', numberOfDocs
(error) ->
console.log 'save error ', error
)
我有点不知所措,不知下一步该怎么办。我的包裹是
meteor-platform
urigo:angular
angularui:angular-ui-router
coffeescript
mquandalle:stylus
civilframe:angular-jade
twbs:bootstrap
angularui:angular-ui-bootstrap
mquandalle:bower
tmeasday:publish-counts
aldeed:collection2
angularutils:pagination
accounts-ui
okland:accounts-phone
accounts-base
不是完整的答案,但要立即解决问题,只需创建一个更新用户配置文件服务器端的方法。只需检查用户是否仅试图编辑自己的个人资料。是否要删除拒绝并仅使用允许?否。我也从来没有在allow中看到log语句,即使我删除了denyYeah,我也在考虑这样做,但这看起来很愚蠢。我已经花了足够多的时间来调查这件事了