user is guest or normal user
Posted: 05 Aug 2015, 14:34
by moris
Hello
i want to know is the costumer guest or real user. it there anu function for getting that?
Re: user is guest or normal user
Posted: 05 Aug 2015, 14:45
by Lapo
Yes,
it simply depends on the privilege Id.
You can read it from client side (ex: C#):
Here's the documentation about how this works:
http://docs2x.smartfoxserver.com/Advanc ... ge-managercheers
Re: user is guest or normal user
Posted: 06 Aug 2015, 11:00
by moris
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.
Re: user is guest or normal user
Posted: 06 Aug 2015, 11:21
by rjgtav
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