parse-platform - 如何防止 parse.com 用户看到他们的部分用户数据?又名在用户类上为每个字段设置 ACL?

标签 parse-platform

我添加新用户。
假设我们在解析用户类上添加了一个“additionaldata1”字段

我不希望用户能够看到存储在“additionaldata1”中的数据,因此不希望在我查询当前解析用户时返回它。

鉴于代码是 web.app,我不希望用户“破解”本地代码以恢复“所有”用户对象数据。

所以我的问题是如何确保 parse.com 用户对象上永远不会返回某些字段,例如“additionaldata1”?我是否必须设置一个与用户相关但将 ACL 设置为非读取的附加类?或者我可以在用户类上为每个字段设置 ACL 吗?

编辑//
更新:我相信我自己解决了这个问题。似乎无法为类的每个字段设置 ACL。因此,我必须将此数据添加到具有 RELATION 的附加类中,然后将该类表上的 ACL 设置为“不读取”和“不写入”。这样,由于主 key ,只有云代码可以看到类值,我可以通过云代码运行任何验证和查询,我需要这些数据对用户是安全/私有(private)的。

最佳答案

此案例在 Parse Docs 中的一对一关系数据 https://www.parse.com/docs/relations_guide#onetoone_anchor 中有所提及.
他们建议您将数据拆分为两个表并使用一对一:

In Parse, a one-to-one relationship is great for situations where you need to split one object into two objects. These situations should be rare, but two examples include:

Limiting visibility of some user data. In this scenario, you would split the object in two, where one portion of the object contains data that is visible to other users, while the related object contains data that is private to the original user (and protected via ACLs).

Splitting up an object for size. In this scenario, your original object is greater than the 128K maximum size permitted for an object, so you decide to create a secondary object to house extra data. It is usually better to design your data model to avoid objects this large, rather than splitting them up. If you can't avoid doing so, you can also consider storing large data in a Parse File.

关于parse-platform - 如何防止 parse.com 用户看到他们的部分用户数据?又名在用户类上为每个字段设置 ACL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24471462/

相关文章:

android-studio - 将 Parse javadoc 添加到 Android Studio

ios - 当我使用 PFQueryTableViewController 子类时出现 Parse.com 错误 'Method not allowed when Pinning is enabled.'

ios - 如何在解析查询结束时仅重新加载一次 TableView ?

javascript - 如何等待 firebase 图片上传

java - 自定义 ParseQueryAdapter 的问题

ios - 如何优化通过 Parse.com 查询填充的 UICollectionView?

java - 使用java读取 "ParseFile"

ios - 如何在我的 iOS 应用程序中调用 Cloud Code Function(Parse)?

javascript - 以下 Parse.com Parse.Cloud 定义、运行和回调代码有什么问题

ios - 部署代码解析云时出错