Skip to content

User Management

Person8880 edited this page Dec 19, 2015 · 6 revisions

Overview

The user management plugin allows you to add/edit/remove users and groups while the server is running. If you have a remote user config, it can also be configured to send these changes to your webserver.

Config

The config looks something like this:

{
    "SendActionsToURL": false,
    "APIURL": "http://yoursite.com/yourendpoint.php",
    "RequestArguments": { "secretarg": "Value" },
    "SubmitTimeout": 5,
    "MaxSubmitRetries": 3
}

The file should be called “UserManagement.json” and should be placed in the directory defined as your plugin config directory (default is config://shine/plugins).

Option Description
SendActionsToURL When true, the plugin will send a POST request to the APIURL every time a change is made to the user data, containing the changed object.
APIURL The URL to send POST requests to with any changes made.
RequestArguments Extra request arguments to add to each request. Use this to secure your request.
SubmitTimeout How long, in seconds, the plugin should wait before it considers a request to the webserver to be timed out.
MaxSubmitRetries How many retry attempts after a timeout the plugin should make before giving up.

Console commands

Command Chat Command Arguments Description
sh_setusergroup !setusergroup <player or steamid> <group> Sets the player's group. If the player does not currently have a user entry, it is created.
sh_setuserimmunity !setuserimmunity <player or steamid> (immunity) Sets the player's immunity value. This will override the group immunity value. Leave immunity empty to remove it.
sh_removeuser !removeuser <player or steamid> Removes the user entry for the given player.
sh_creategroup !creategroup <groupname> (immunity) (blacklist?) Creates a new group with the given name, and optionally the given immunity and blacklist setting.
sh_setgroupimmunity !setgroupimmunity <groupname> <immunity> Sets the given group's immunity value.
sh_setgroupisblacklist !setgroupisblacklist <groupname> <blacklist?> Sets whether the group's commands are a blacklist or a whitelist.
sh_setgroupinheritance !setgroupinheritance <groupname> <inheritgroup> (remove?) Sets whether the given group inherits from the second group.
sh_setgroupaccess setgroupaccess <groupname> <access string> (revoke?) Sets whether the given group has access to the given access string.
sh_removegroup !removegroup <groupname> Removes the given group.
sh_groupinfo N/A (groupname) Displays information about the currently configured groups. Pass a group name to view more detailed information.
sh_listusers N/A N/A Displays a list of all configured users.

Request Format

The plugin's requests take the form:

http://yoursite.com/yourendpoint.php?operation={OPERATION_ID}&data={JSON data}

OPERATION_ID can be one of the following:

  • EDIT_USER - Denotes that the data is a user entry. Note that the user may not exist yet.
  • REMOVE_USER - Denotes that the user is being removed. Its data is still present in the request.
  • EDIT_GROUP - Denotes that the data is a group entry. Note that the group may not exist yet.
  • REMOVE_GROUP - Denotes the the group is being removed.

The JSON format will always be of the following form:

{
    "ID": "123456", // This ID will either be the ID of the user, or the name of the group.
    "Data": {
        // Full user or group entry, same format as those in UserConfig.json
    }
}

Response Format

The plugin expects a simple response to its requests, that indicates whether the webserver has accepted the change made or not.

{
    "success": true
}

If "success" is true, then no further action is performed. Otherwise, if it is false, then the plugin will revert the change it made locally.

Clone this wiki locally