user is guest or normal user

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

Moderators: Lapo, Bax

moris
Posts: 45
Joined: 17 Aug 2012, 11:11

user is guest or normal user

Postby moris » 05 Aug 2015, 14:34

Hello

i want to know is the costumer guest or real user. it there anu function for getting that?
User avatar
Lapo
Site Admin
Posts: 20847
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: user is guest or normal user

Postby Lapo » 05 Aug 2015, 14:45

Yes,
it simply depends on the privilege Id.

You can read it from client side (ex: C#):

Code: Select all

if (user.PrivilegeId == 0) ...


Here's the documentation about how this works:
http://docs2x.smartfoxserver.com/Advanc ... ge-manager

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
moris
Posts: 45
Joined: 17 Aug 2012, 11:11

Re: user is guest or normal user

Postby moris » 06 Aug 2015, 11:00

I need it on the server side, not the client side. now i`m checking this with username. if the username contains the prefix of the guest.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: user is guest or normal user

Postby rjgtav » 06 Aug 2015, 11:21

Hi,

On the server-side, on the User object, you have the .getPrivilegeId() method which does the same as the client-side version Lapo presented.

For example, your code should look something like:

Code: Select all

if (user.getPrivilegeId() == 0) ...

where user is an User object.

For more informatio you can read getPrivilegeId() 's documentation at:
http://docs2x.smartfoxserver.com/api-docs/javadoc/server/com/smartfoxserver/v2/entities/User.html#getPrivilegeId()

Cheers
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 8 guests