Hi,
In my VW implemetation, the user data is persistant (DB) and I cannot permit 2 sessions of the same user updateding its records.
I have a problem where canLogin does not disconnects a user with the same username if it logs into another zone.
Apparntly the username is not unique on the server ...
I would have disconnected the user manully (scanning all zones and logging out the user by name) but I cannot find an java API gives all the active zones.
Can you help?
Thanks.
Username as an identifier
Hi Lapo,
Thanks for the reply.
I understand the username scope in the server.
However I need to find a solution to my requirement.
Is there a java API exposing such traversal, or can you think of another solution to my problem?
Thanks
Thanks for the reply.
I understand the username scope in the server.
However I need to find a solution to my requirement.
In the Admin tool all the zones are exposed, so I guess there is a way to traverse them.I would have disconnected the user manully (scanning all zones and logging out the user by name) but I cannot find a java API gives all the active zones.
Is there a java API exposing such traversal, or can you think of another solution to my problem?
Thanks
Zones are defined statically, so you should know which zones you are using.
Simply set a list of active zone names in your code, then you can get the related Zone object by calling:
You can verify the presence of a user by calling
It will return null if no user with that name is logged in that zone.
Simply set a list of active zone names in your code, then you can get the related Zone object by calling:
Code: Select all
Zone z = SmartFoxServer.getInstance().getZone("the-name")Code: Select all
User u = z.getUserByName("user-name")Thanks again Lapo,
I would like to insists a little further.
It is true that the zones are defined statically, however I would not like to change my application code each time I change the zone definition. It would lead to an error prone deployment.
Therefore it would ease me alot if I could get this data from the sfs without having to parse the config.xml on my own.
Thanks
I would like to insists a little further.
It is true that the zones are defined statically, however I would not like to change my application code each time I change the zone definition. It would lead to an error prone deployment.
Therefore it would ease me alot if I could get this data from the sfs without having to parse the config.xml on my own.
Thanks
No problem, I should have mentioned this as well but I forgot
Code: Select all
LinkedList<Zone> allTheZones = SmartFoxServer.getInstance().getAllZones()