Hi,
I was just wondering if there any API in ES4 in which you can kick user out from a specific zone and room or disconnect them,
regards,
muhwas
Hi,
I was just wondering if there any API in ES4 in which you can kick user out from a specific zone and room or disconnect them,
regards,
muhwas
Well, that's all dependent on if the connected user has the correct privileges set. Out-of-box, every user connecting to ElectroServer is treated as a normal, non-operator user thus has no privs to do anything that an operator can do like kicking or banning users. You would first need to write some logic on the server-side to determine which connecting users are meant to be promoted to an operator status.
You can create different status levels by going into the web admin tool under Security and choose Manage Permission Sets. From there, you can create an "admin" permission level that is allowed to kick a user. After that is done, you will need to write a server extension that will take the user's login credentials, check them against a user list (normally stored in a DB), and promote that user to the newly-created "admin" permission level. The client API will recognize this automatically as all transactions for this type of thing are sent to the server.
You may want to look at the LoginEventHandler description on our wiki to give you some insight as to what to do next. Feel free to add any additional questions you may have about this to this thread.
It can certainly be done by a plugin. Try:
getApi().kickUserFromRoom(String userName,
int zoneId,
int roomId,
String reason)
getApi().banUserFromRoom(String userName,
int zoneId,
int roomId,
int duration,
String reason)
getApi().kickUserFromServer(String userName,
EsObjectRO reason)
Teresa Carrigan
Senior Engineer
Electrotank, Inc.
You could also do it that way but that's a little open-ended on who can do it. If you choose to do it Teresa's way, you'll want to assure the user doing it is allowed to or else it'll be a server kickfest.
The times I've used it have not been simple requests from clients. Profanity for example - kick from room and ban for 15 minutes, and repeat offenders get kicked from the server.
Teresa Carrigan
Senior Engineer
Electrotank, Inc.
This just goes to show you how feature-rich ElectroServer is.![]()
What do you mean with that "The client API will recognize this automatically as all transactions for this type of thing are sent to the server." . Is there a way "from the client point of view" telling the user who logs in has which permission set? For instance my nickname is registered with a permission set named "Admin" in a db which is also registered in ES5. I log in and login event handler query my permission set and set my permission set as Admin. Is there a functionality from the client side telling me that you have a permission set named Admin?
There isn't a way that is already built in. It's very easy to add this. If all you need is this information in the LoginResponse, you can add it as the optional EsObject that appears in the LoginResponse. The LoginEventHandler does this with context.setResponseParameters, which puts the EsObject onto the LoginContext.
If you need the info at other times, make a server level plugin that looks it up: getApi().getPermissionSetId(username). The client sends a plugin request, the plugin looks it up then sends a plugin message to the client.
If other users need to be able to see the information too, then have the LoginEventHandler add a UserVariable with the information. You would need to set user permissions so that users could not change their own user variables in this case, or else implement a UserVariableEventHandler, or you could have a hacker with a modified client pretend to be an admin.
Let me know which way you choose, and I can give you more details if you need them.
Teresa Carrigan
Senior Engineer
Electrotank, Inc.