What is the best way to restrict client from calling certain cloudscript functions?
For example certain events are only meant to be triggered from playstream events or maybe a rule triggers it.
Thanks
What is the best way to restrict client from calling certain cloudscript functions?
For example certain events are only meant to be triggered from playstream events or maybe a rule triggers it.
Thanks
Setting PlayFab API policy can prevent clients from calling API ExecuteCloudScript, but PlayFab Policy doesn’t supports restrict access to the specific CloudScript function. When CloudScript function is triggered by a PlayStreamEvent, the info of this PlayStreamEvent would be contained in the context. So you can make conditional judgments in the function to limit the execution of valid logic. You can refer to the following testing CloudScript function.
handlers.handlePlayStreamEventAndProfile = function (args, context) { var psEvent = context.playStreamEvent; if (psEvent != null) { // use the specific event name if (psEvent.EventName == "player_logged_in") { //do something return { result: "executed the function" }; } else { return { result: "nothing happened" }; } } else { return { result: "nothing happened" }; } };
Please also check the answer in this thread: https://community.playfab.com/questions/43830/can-a-player-call-a-function-that-is-scheduled.html?childToView=43843#comment-43843
4 People are following this question.