Changing data in another PFuser object

前端 未结 3 998
南旧
南旧 2021-01-06 00:28

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 v

3条回答
  •  我在风中等你
    2021-01-06 00:42

    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

    From the parse documentation -

    Security For User Objects

    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.

    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.

提交回复
热议问题