question

ntanda avatar image
ntanda asked

Master account's Entity Files - allow access to all

Hello,

I was wondering if we could change the Global Policy to allow the Master Account Files to be downloaded by other players (friends and strangers)?

Is it something we need to do on the title level (in Settings), or via API call when uploading the file? I couldn't find how to set the policy json for the files anywhere...

I've read on another question that the UI for it was still in progress, but that might have been for Objects, I'm not sure.

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.

pfnathan avatar image
pfnathan answered

Please add following code to your title's Global Title Policy:

{
      "Effect": "Allow",
      "Resource": "pfrn:data--*!*/Profile/Files/FILENAME",
      "Principal": { "ChildOf": { "EntityType": "namespace", "EntityId": NAMESPACEID} },
      "Comment": "Allow all namespace members to read files",
      "Action": "Read"
}

You can edit your policy on: GameManager-> Settings-> API/ Entity Global title Policy

also:

https://api.playfab.com/documentation/entity/method/GetGlobalPolicy

https://api.playfab.com/documentation/entity/method/SetGlobalPolicy

We have not updated few changes we have made to the documents yet, we will post an update once it gets released.

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.

ntanda avatar image ntanda commented ·

I've added this to my titles (replacing FILENAME and NAMESPACEID appropriately), and still get a "NotAuthorized" error when trying to GetFiles for a friend's ID :/

0 Likes 0 ·
ntanda avatar image ntanda commented ·

Hi, I've tried the suggested fix above without success.

I also tried to set "Principal" to "*"... I still get "NotAuthorized" when querying files for friends. Adding the "master_player_account" flag after "pfrn:data--" doesn't work on the Global Setting, as it refuses to save the policy.

Setting the Policy manually on the target user's dashboard works, but it's obviously not a viable solution.

0 Likes 0 ·
ntanda avatar image
ntanda answered

Hi, I've tried the suggested fix above without success.

I also tried to set "Principal" to "*"... I still get "NotAuthorized" when querying files for friends. Adding the "master_player_account" flag after "pfrn:data--" doesn't work on the Global Setting, as it refuses to save the policy.

Setting the Policy manually on the target user's dashboard works, but it's obviously not a viable solution.

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.

ntanda avatar image ntanda commented ·

Since setting the Global Policy hasn't worked so far, I have found a workaround, by using SetProfilePolicy.

On entrance of our game, I'm calling it to set the master account file to be accessible to everyone.

It looks like:

PlayFabEntityAPI.SetProfilePolicy(new SetEntityProfilePolicyRequest()
{
    Entity = new EntityKey()
    {
        Id = playFabID,
        Type = EntityTypes.master_player_account
    },
    Statements = new List<EntityPermissionStatement>()
    {
        new EntityPermissionStatement()
        {
            Action = "Read",
            Effect = EffectType.Allow,
            Resource = string.Format("pfrn:data--master_player_account!{0}/Profile/Files/{1}", playFabID, filename),
            Condition = null,
            Principal = "*"
        }
    }

}, (response) =>
{
    // callback success

}, (error) =>
{
    // callback error
});

I'm surrounding the call to make sure it's only called once, so that'll do until the Global Policy actually works.

-1 Like -1 ·
pfnathan avatar image pfnathan ♦ ntanda commented ·

Thanks for sharing the workaround, on the Global Policy side, at the moment, you can only use the title_player_account at the title global policy level.

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.