private user variables

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

FireSmartFox
Posts: 33
Joined: 28 Sep 2018, 19:47

private user variables

Postby FireSmartFox » 04 Dec 2018, 16:19

Hi,
simple question, but can't find the answer to it:
Is a user variable, set as private by server, for user read-only? Or can the user change the value illegal? I am thinking about assign functionality only for a few users set by a variable boolean.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: private user variables

Postby Lapo » 04 Dec 2018, 17:02

Hi,
no, private variables can be changed by their owner.

Or can the user change the value illegal?

They could, if they send a SetUserVariableRequest from client side.

There are two possible ways to deny changes:
1) Use a SystemController filter:
http://docs2x.smartfoxserver.com/Advanc ... er-filters

2) Use an Extension instead.
This way you can initialize Users with certain game values that will be read-only on the client side.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
FireSmartFox
Posts: 33
Joined: 28 Sep 2018, 19:47

Re: private user variables

Postby FireSmartFox » 04 Dec 2018, 18:04

I see.
But I can make, in case of an extension, the user variable hidden and private so the user will never know which name this variable has and then I can at least do some server stuff like send all user extra content with a certain variable value?
I think I will create a class for the user properties on the server anyway. :)
User avatar
Rob
Posts: 53
Joined: 01 Jul 2017, 07:33

Re: private user variables

Postby Rob » 05 Dec 2018, 07:16

Lapo wrote:There are two possible ways to deny changes:
1) Use a SystemController filter:
http://docs2x.smartfoxserver.com/Advanc ... er-filters

2) Use an Extension instead.
This way you can initialize Users with certain game values that will be read-only on the client side.

A third alternative would be to remove the SetUserVariables permission with the User Privilege Manager. This would block all user variable changes from clients, so it depends on the use-case if it's suitable.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 58 guests