question

ksb951031 avatar image
ksb951031 asked

Change Permission Only

Hello. I created permissions as private while creating player data. But I'm trying to change it to make it readable to external users. Can I change only permissions to Public with cloud scripts?

Player Data
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Neils Shi avatar image
Neils Shi answered

Yes, you can change the permissions of player data to “Public” using CloudScrip via API UpdateUserData. For more info, you can refer to the example code below:

 handlers.updateUserDataPermission = function (args, context) {
       var UpdateUserDataRequest = {
           "PlayFabId": "xxxxxxxxxx",
           "Data": {
                // your data goes here
           },
           "Permission": "Public"
      };
      server.UpdateUserData(UpdateUserDataRequest);
 }
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ksb951031 avatar image ksb951031 commented ·

If I do as you said, can I change only permission without changing the existing value?

0 Likes 0 ·
Neils Shi avatar image Neils Shi ksb951031 commented ·

Yes, you can change permissions without changing existing values. You can call the API GetUserData to get the original key value first, and then call the API UpdateUserData to modify the permissions.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.