question

Jon avatar image
Jon asked

Restrict write access to Player entity object

How can we restrict client write access to an entity object?

For player data there is Player, Internal, ReadOnly.

Thanks

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

·
Sarah Zhang avatar image
Sarah Zhang answered

To deny the player’s write access to their specific Entity Object, you would need to add the corresponding Global Policy to the title. You can set the global policy in the Game Manager or using API SetGlobalPolicy. You can check the API reference for the more description of the permission statement. If you want to set it in the Game Manager, you can find the [ENTITY GLOBAL TITLE POLICY] in [Game Manager]->[Title settings]->[API Features] page. (https://developer.playfab.com/en-US/r/t/[YourTitleId]/settings/api-features)

Please refer to the following policy to add the “deny” policy for the specific Entity Object. This policy would only allow title to edit the player’s specific Entity Object. Please replace [YourEntityObjectName] with the actual entity object name.

{
  "Resource": "pfrn:data--*!*/Profile/Objects/[YourEntityObjectName]",
  "Action": "Write",
  "Effect": "Deny",
  "Principal": "*",
  "Comment": "Only title can edit user [YourEntityObjectName] Objects",
  "Condition": {
    "CallingEntityType": "title_player_account"
  }
},
{
  "Resource": "pfrn:data--*!*/Profile/Objects/[YourEntityObjectName]",
  "Action": "Write",
  "Effect": "Deny",
  "Principal": "*",
  "Comment": "Only title can edit user [YourEntityObjectName] Objects",
  "Condition": {
    "CallingEntityType": "character"
  }
},
{
  "Resource": "pfrn:data--*!*/Profile/Objects/[YourEntityObjectName]",
  "Action": "Write",
  "Effect": "Deny",
  "Principal": "*",
  "Comment": "Only title can edit user [YourEntityObjectName] Objects",
  "Condition": {
    "CallingEntityType": "master_player_account"
  }
}

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.

Jon avatar image Jon commented ·

Thanks, how does the path for resource work for entities?

Looking at the doc I see

https://docs.microsoft.com/en-us/gaming/playfab/features/data/entities/available-built-in-entity-types

I am using the title_player_account so I thought it would be /Profile/Objects/title_player_account/[YourEntityObjectName]

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Jon commented ·

Entity types should be set with CallingEntityType field. You can find it in the example.

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.