在另一个PFuser对象中更改数据 [英] Changing data in another PFuser object

查看:72
本文介绍了在另一个PFuser对象中更改数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的游戏中,一个用户可能对另一个用户造成损害,并夺走部分黄金. gold变量存储在其他用户PFUser对象中.一个用户如何更改另一个用户PFUser对象中存储的黄金的价值?

In my game, a user can cause damage to another user, and take some of their gold. The gold variable is stored in the other users PFUser object. How can one user change the value for the gold that is stored in the other users PFUser's object?

推荐答案

您无法保存或删除未经身份验证的PFUser.实现该功能的方法是为公共的读/写用户变量设置一个单独的类

You can not save or delete non-authenticated PFUsers. The way to implement that functionality is to set up a separate class for public read/write user variables

从分析文档中-

用户对象的安全性

Security For User Objects

默认情况下,PFUser类是安全的. PFUser中存储的数据可以 只能由该用户修改.默认情况下,仍可以读取数据 由任何客户.因此,某些PFUser对象已通过身份验证,可以通过 修改,而其他则为只读.

The PFUser class is secured by default. Data stored in a PFUser can only be modified by that user. By default, the data can still be read by any client. Thus, some PFUser objects are authenticated and can be modified, whereas others are read-only.

具体来说,您将无法调用任何保存或删除操作 除非PFUser是使用经过身份验证的方法获得的,否则, 如logIn或signUp.这样可以确保只有用户才能更改他们的 自己的数据.

Specifically, you are not able to invoke any of the save or delete methods unless the PFUser was obtained using an authenticated method, like logIn or signUp. This ensures that only the user can alter their own data.

这篇关于在另一个PFuser对象中更改数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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