question

kirk-moonlight avatar image
kirk-moonlight asked

101 Questions about Entities

I have 101 questions about Entities, starting with tokens and groups... let's begin.

Has documentation on Policy been made available yet?

Can I call any of the Entity methods from CloudScript? I know I can use PlayFabCloudScriptAPI.ExecuteEntityCloudScript but it seems that it just bypasses CloudScript and calls the Entity method.

I'd like to call GetEntityToken from CloudScript to get a 'title' level auth token so I don't store the X-SecretKey on our client app. It's at least one level of security abstraction to help to avoid issues.


We're trying to use Entity Groups to manage lists of Friends for a few aspects of our app. I'd like to be able to allow the entity that creates a Group (the group admin) to be able to add other players to their group (a list of all of their Facebook friends that also have PlayFab linked accounts) without having to go through the Invite/Accept steps. I know if I set the policy properly I can allow this behavior, but I don't know exactly how to setup this policy, and I don't want to 'experiment' as we're close to release and don't want to mess things up mucking around with undocumented features. That's where the question about GetEntityToken come in, we apparently need a 'title' account to provide some features we'd like to implement with Entity Groups.

We use GetPlayFabIDsFromFacebookIDsRequest to retrieve player's PlayFabId from their Facebook friend's Id, but the returned PlayFabId is a master_player_account, and the entity system needs title_player_account. So we try to use GetProfile to retrieve the title_player_account but we don't have permissions set properly, round and round we go.

We're tentatively trying to release by the end of this month, so waiting for the new Entity system update isn't an option. I have the code written that's manages these aspects of Friends lists utilizing Groups except for modifying Policy, so that's really where I need the most help at the moment.

Summary

1. CloudScript to call GetEntityToken with X-SecretKey (in cloudscript handler as to not have X-SecretKey on the client app).

2. use GetProfile with master_player_account PlayFabId to get the title_player_account PlayFabId to add that player to a group and invite/apply to group with proper title_player_account PlayFabId.


3.Use 'title' level level auth token to be able to allow 'group admins' to add a list of facebook friends to a group directly.

If we can get those things done, we'll be well on our way to having a working group management system.

Thanks for listening.



entities
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

·
Hernando avatar image
Hernando answered

>>Has documentation on Policy been made available yet?

There is no detailed documentation about Group Policy at this moment as it is currently under development and some features may be modified, so we suggest you not using API policy or Entity Policy at the moment. If you are considering a policy like auto-approval, the simplest way is that adding a player to a group directly without any application via AddMembers. More information please see: https://community.playfab.com/questions/18393/implementing-auto-accept-guildclan-policy-problem.html

>>Can I call any of the Entity methods from CloudScript?

There's an entity.x (e.g entity.AddMember) variable available that exposes entity APIs in CloudScript. And the call from CloudScript will work as a Title level entity, that bypass the permission checks.

>>So we try to use GetProfile to retrieve the title_player_account but we don't have permissions set properly, round and round we go.

For those master_player_account returned from GetPlayFabIDsFromFacebookIDs, you can retrieve the entity for title_player_account with GetAccountInfo base on master_player_account, then collect all friends' title_player_account and send them to CloudScript as a parameter for AddMenbers.

The thing have to be aware of is exporting friend list from facebook and add them in you game may violate facebook protocol.

6 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.

kirk-moonlight avatar image kirk-moonlight commented ·

Is there a documentation link you can provide regarding the entity cloudscript variable?

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang kirk-moonlight commented ·

Hi, I guess you want the entity.x variable that you can use when you call a PlayFab Entity API in the CloudScript. Now we don’t have any doc directly list the entity.x variable in the CloudScript.

Actually the default CloudScript revision (Revision 1) provided by PlayFab will give you some information. (You can find it in your Game Manager, select your title then select Automation on the left side bar. Learn more about the default CloudScript revision, please read Your first CloudScript revision.) This revision includes a method about how to call a PlayFab Entity API. At line 76, like the following image.

The pre-defined 'entity' object has functions corresponding to each PlayFab Entity API, including 'SetObjects'.

For more functions please check the API Reference and use those functions under Data and Groups.

If you want to know more about PlayFab Entities, you can check Entities docs.

0 Likes 0 ·
andy-3 avatar image andy-3 Sarah Zhang commented ·

Hi @Sarah Zhang For some reason I'm not able to see the images you shared. Could you include a link to them.

0 Likes 0 ·
Show more comments

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.