1 | # Admin Controls
|
2 |
|
3 | The `/admin` [special command](SpecialCommands.md) provides the ability to control the usage of core modules.
|
4 |
|
5 | This is done through the concept of permission names. One or more permission names are associated with a core module. Only if a user has been granted one of those permission names is it possible for them to use that core module. Configuring should typically occur before starting the bot, as the `/admin` command is only designed for fine tuning after startup.
|
6 |
|
7 | Configuration takes the form of the `admin` section in the main `config.json` file in the following format:
|
8 | ```json
|
9 | {
|
10 | "admin": {
|
11 | "modules": {
|
12 | "<coreModuleName1>": ["<permissionName1>", "<permissionName2>", ...],
|
13 | "<coreModuleName2>": ["<permissionName3>", "<permissionName1>", ...],
|
14 | },
|
15 | "users": {
|
16 | "<usersFullNameOrID>": {
|
17 | "<threadIdRegex>": ["<permissionName1>", "<permissionName2>"]
|
18 | },
|
19 | ...
|
20 | }
|
21 | }
|
22 | }
|
23 | ```
|
24 |
|
25 | For example, if you had the users "foo" and "bar". "foo" should be able to shutdown and update, but "bar" should only be able to update. The following configuration would achieve that (there are many ways of acheiving the same goal):
|
26 | ```json
|
27 | {
|
28 | "admin": {
|
29 | "modules": {
|
30 | "shutdown": ["canShutdown"],
|
31 | "update": ["canUpdate"]
|
32 | },
|
33 | "users": {
|
34 | "foo": {
|
35 | ".*": ["canShutdown", "canUpdate"]
|
36 | },
|
37 | "bar": {
|
38 | ".*": ["canUpdate"]
|
39 | }
|
40 | }
|
41 | }
|
42 | }
|
43 | ```
|
44 |
|
45 | **Notes**:
|
46 | - Permissions can have any name
|
47 | - If no permission is added to a core module, then everyone will have access
|
48 | - Users without access to a module will not see help for that module and will not receive responses from it
|
49 | - It is possible to lock out everyone from a core module. In the case that both `/shutdown` and `/restart` have no users that can access them - it is not possible to shutdown while safely saving module configuration.
|