question

Benjamin Schug avatar image
Benjamin Schug asked

Character Group Policy

I am trying to implement teams of player characters. Creating a group of characters works fine and shows up correctly in the PlayFab console. But when I try to use ListMembership on the character from the Unity SDK, it returns an empty list. I figured out that this is because the default group policy allows only members of the group to call this. Changing the policy to give everyone read access fixed it and I can see the group.

However, this is not a solution because the same applies to write requests like RemoveMembers and AcceptGroupApplication, and we cannot make those public obviously. What we really need is a group policy that gives access to the player that owns the character in the group. But I cannot find any documentation on the format of the Principal field in the policy other than "you can use * to match anyone".

Is there any documentation on the policy format? What is the recommended way of doing groups of characters?

entitiesCharacters
10 |1200

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

Seth Du avatar image
Seth Du answered

I don't suggest modifying the Policy for this requirement. According to your description, it seems you add characters as a member of a group. To perform group actions, you need to ensure the caller is a character, and you can call GetEntityToken API and input the character entity in the request like below to get a valid entity token:

{
      "Entity":{
      "Id": "xxxxxxxxxxxxx",
      "Type":"character"
  }
}

If you are using C# or Unity SDK, Playfab instance API can help with handling multiple login identites.

10 |1200

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

Benjamin Schug avatar image
Benjamin Schug answered

To clarify: I'm trying to call ListMembership from the user that owns the character. So from what I understand, the policy rejects the request because the character is a member of the group, but the player that owns it is not. This is not about accessing someone else's group.

10 |1200

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

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]