question

Ozan Yilmaz avatar image
Ozan Yilmaz asked

How To Prevent Players From Changing Their Display Name?

Hello everyone,

I want the players to be able to setup their display name while registering an account in the game. Afterwards, they will be able to change their display name by using a virtual currency. My question is how can I prevent the players from changing their display name? And how can I set their display name by using cloudscript?

I found "Permission Policies" on the Internet but I didn't understand the logic exactly. A code example for this question would be really helpful.

1 comment
10 |1200

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

Ozan Yilmaz avatar image Ozan Yilmaz commented ·

Bump.

I am still looking for a solution for this. I have found this thread but the solution is not clear. It looks like he changed ApiPolicy, but where is that option?

https://community.playfab.com/questions/33603/cant-quite-get-policy-json-work-as-i-wanted.html

0 Likes 0 ·

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

>> how can I prevent the players from changing their display name?

You can navigate to this doc API access policy for more info on how to set API access policy. In addition to using C# code to achieve this target, you also can use external REST API testing tools (for example, Postman, you can find Postman SDK here) to set the API policy. You need to set it via Admin API UpdatePolicy, and please refer to the following content to deny the access of Client API UpdateUserTitleDisplayName.

{
  "PolicyName": "ApiPolicy",
  "Statements": [
    {
      "Resource": "pfrn:api--*",
      "Action": "*",
      "Effect": "Allow",
      "Principal": "*",
      "Comment": "The default allow all policy"
    },
    {
      "Resource": "pfrn:api--/Client/UpdateUserTitleDisplayName",
      "Action": "*",
      "Effect": "Deny",
      "Principal": "*",
      "Comment": "This statement denies request to UpdateUserTitleDisplayName"
    }
  ],
  "OverwritePolicy": false
}

>> And how can I set their display name by using cloudscript?

Currently, PlayFab only provides Admin and Client API UpdateUserTitleDisplayName to update the title specific display name for a user. CloudScript methods have full access to PlayFab's Server API set, but can’t access admin API directly. The recommended solution is building your own custom server or admin management tool to call the Admin API like UpdateUserTitleDisplayName.

1 comment
10 |1200

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

Ozan Yilmaz avatar image Ozan Yilmaz commented ·

Thank you so much :)

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.