+ Reply to Thread
Results 1 to 8 of 8

Thread: kicking user out

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    kicking user out

    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

  2. #2
    Senior Member
    Join Date
    Jul 2008
    Posts
    341
    Thanks
    0
    Thanked 2 Times in 2 Posts

    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.

  3. #3
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,213
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    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.

  4. #4
    Senior Member
    Join Date
    Jul 2008
    Posts
    341
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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.

  5. #5
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,213
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    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.

  6. #6
    Senior Member
    Join Date
    Jul 2008
    Posts
    341
    Thanks
    0
    Thanked 2 Times in 2 Posts
    This just goes to show you how feature-rich ElectroServer is.

  7. #7
    Member
    Join Date
    Sep 2011
    Location
    Ankara
    Posts
    91
    Thanks
    31
    Thanked 3 Times in 2 Posts
    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?

  8. #8
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,213
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    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.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts