question

Darius Vu avatar image
Darius Vu asked

List Group Members Response is always 0

Dear Team,

I am using this function - PlayFabGroupsAPI.ListGroupMembers to get the number of members in the group before joining it as below:

SearchGroup(m_FamilyNameInputFieldControl.GetText(), SearchGroupSuccessCallback);

private void SearchGroupSuccessCallback(GetGroupResponse response)
{
	GetListGroupMember(response.Group, GetGroupMemberCallback);       
}

private void GetGroupMemberCallback(ListGroupMembersResponse response)
{
        int memberNum = 0;
        foreach (EntityMemberRole memberRole in response.Members)
        {
            foreach (EntityWithLineage member in memberRole.Members)
            {
                memberNum++;
            }
        }
        
	Debug.Log("The number of members: " + memberNum);   // This is always 0
}

But if I use this function when an user in the group already then it is working.

So cannot I use this function like above?

Thank you so much!

Shared Group 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

·
Gosen Gao avatar image
Gosen Gao answered

Group has its own policy to handle the request. It will not let an Entity which is not in the Group perform action on it by default. If you want players out of the Group to call API ListGroupMumbers, you should modify the Policy. You could find it at [Game Manager] -> [Groups] -> [specific group] -> [Policy]. You could also use API SetProfilePolicy to modify the group policy.

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.

Darius Vu avatar image Darius Vu commented ·

Thank you so mcuch for your support. Could I change the ENTITY GLOBAL TITLE POLICY to apply for all groups?

If we can do it then how we should add? Some things like this.

{
    "Action": "*",
    "Effect": "Allow",
    "Resource": "pfrn:group--group!*/Invitations/*",
    "Principal": "*",
    "Comment": null,
    "Condition": null
  }

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao Darius Vu commented ·

Yes, you could change the ENTITY GLOBAL TITLE POLICY to apply for all groups. You can add the follow permissions to it.

  {
    "Action": "Read",
    "Effect": "Allow",
    "Resource": "pfrn:group--*!*/Members/*",
    "Principal": {
      "ChildOf": {
        "EntityType": "title",
        "EntityId": "YourTitleID"
      }
    },
    "Comment": "Allow all entities to view members of the group",
    "Condition": null
  },
  {
    "Action": "Read",
    "Effect": "Allow",
    "Resource": "pfrn:group--*!*/Roles/*",
    "Principal": {
      "ChildOf": {
        "EntityType": "title",
        "EntityId": "YourTitleID"
      }
    },
    "Comment": "Allow all entities to read all roles in the group",
    "Condition": null
  }<br>
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.