谷歌云数据存储/移动后端入门 - 在更新/ updateAll呼叫权限失败 [英] Google Cloud Datastore / Mobile Backend Starter - Permissions failure on update/updateAll calls

查看:248
本文介绍了谷歌云数据存储/移动后端入门 - 在更新/ updateAll呼叫权限失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用移动后端启动(MBS)的​​Andr​​oid类(创建在谷歌开发控制台一个新项目时,这些分布式作为样本项目,并演示了在谷歌I / O 2013)我可以插入新的实体到云数据存储通过调用CloudBackendMessaging.insertAll或.updateAll。后者将创建实体,如果不存在这样似乎功能上等同于插入新记录。

Using the Mobile Backend Starter (MBS) Android classes (those distributed as a sample project when creating a new project in Google Dev Console and demoed at Google I/O 2013) I'm able to insert new entities to the cloud datastore via calls to CloudBackendMessaging.insertAll or .updateAll. The latter will create entities if none exist so seems functionally identical to insert for new records.

插入/创建工作正常。然而,当我试图更新现有条目在数据存储中,我收到一个权限错误,例如(从后端日志)

The insertion/creation works fine. However when I attempt to update existing entries in the datastore, I received permissions errors e.g. (from the backend log)

方法:mobilebackend.endpointV1.updateAll

Method: mobilebackend.endpointV1.updateAll

错误code:401

Error Code: 401

原因:需要

消息:XXXXXX按:USER:用于更新CloudEntity Insuffient许可YYYYYYY

Message: Insuffient permission for updating a CloudEntity: XXXXXX by: USER: YYYYYYY

这导致了匹配访问错误中logcat中客户端。

which results in a matching access error in the logcat client side.

在所有情况下,我使用的安全访问与一个有效的谷歌帐户(我自己)认证。

In all cases I am using Secured access authenticating with a valid Google account (my own).

被插入的实体从而呈现出与被更新和创建的显示我的谷歌帐户的电子邮件地址拥有我的用户ID。

The entities being inserted are thus showing as "owned" by my user ID with "updated by" and "created by" showing my Google account's email address.

然而,当现有记录的更新而成,使用完全相同的CloudBackendMessenger对象,因此相同的凭据等后端告诉我,我不能因为权限问题更新。但可以肯定,如果我刚才提出的实体相同的凭据,这不可能是正确的?看着它看来,我应该能够在所有情况下编辑由同一用户ID拥有的实体文档(无论KindName,以及是否是prepended [公用],[私人]或没有)。

However when the update of the existing record is made, using exactly the same CloudBackendMessenger object and thus same credentials etc. the backend is telling me I can't update due to permissions issues. But surely if I just made the entity with the same credentials this can't be correct? Looking at the documentation it appears that I should be able to edit entities owned by the same user ID in all cases (regardless of the KindName and whether it is prepended [public], [private] or nothing).

谁收到权限错误信息的更新,通过手机后台启动了Datascore任何人都可以请有何启示?我一直在敲打我的头在这个大多数今天。

Can anyone who has received permissions errors on UPDATES via Mobile Backend Starter for Datascore please shed any light? I have been banging my head over this for most of today.

推荐答案

我面临类似的错误Insuffient权限更新CloudEntity使用cloudBackendAsync.update(cloudEntity)时。我通过确保cloudEntity有它的createdAt字段集解决它。 createdAt是自动生成的,我想我不应该去碰它。但它为我工作。就我而言,我第一次获得云实体名单。这是当我得到云实体createdAt领域。然后,当我更新我设置createdAt领域从previously获得实体。 编辑:不得不做类似的事情,业主现场还

I've faced the similar error "Insuffient permission for updating a CloudEntity" when using cloudBackendAsync.update(cloudEntity). I resolved it by making sure the cloudEntity has it's createdAt field set. createdAt is autogenerated and I think I am not supposed to touch it. But it worked for me. In my case I am first obtaining list of cloud entities. This is when I get createdAt field of cloud entities. Then when I am updating I setting the createdAt field from previously obtained entities. Had to do similar thing for owner field also.

这篇关于谷歌云数据存储/移动后端入门 - 在更新/ updateAll呼叫权限失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆