Whitelist-API/README.org

218 lines
12 KiB
Org Mode
Raw Permalink Normal View History

2023-11-27 12:29:47 -06:00
#+OPTIONS: H:99 ^:nil
2023-11-01 11:24:12 -05:00
* Squad Whitelist Management
2024-02-09 13:26:32 -06:00
** As a ...
*** Admin
- Someone who administrates the actual whitelisting service
-
*** Organization Owner/Admin
- Someone who runs a Squad community, like Asgard Eternal
- What should they be able to do?
2023-11-01 11:24:12 -05:00
** Discord Bot
*** Commands
2023-11-27 12:29:47 -06:00
- */link*
- Example: =/link 7312312312395=
- Links user's discord ID with their provided steam64
- If linked to another discord id, reject
- Use the user's discord username for their username in the API
2023-11-01 11:24:12 -05:00
2023-11-27 12:29:47 -06:00
- */group-link*
- Example: =/group-link @Odin {group-uuid}=
- Links a Group on the API with a given discord ID for the role
- If the Discord ID already exists, inform about it but allow
2023-11-01 11:24:12 -05:00
2023-11-27 12:29:47 -06:00
- */list-groups*
- Example: =/list-groups=
- Outputs:
- Groups with Associated Discord Role
- Example: =@Odin | https://my-api.com/org/asgard/group-uuid=
2023-11-01 11:24:12 -05:00
*** Events
2023-11-27 12:29:47 -06:00
- *on-member-update*
- For each member, look at the change in discord roles
- If they had a role added to them that's a linked group, add them to the Group
- If they don't have a linked Steam64, ping them in a channel to do so
- *on-startup*
- Hit up API for all members of linked roles
- Check if the members are in those roles and modify as needed
2023-11-01 11:24:12 -05:00
2024-02-09 13:26:32 -06:00
** API
*** General Layout
2023-11-01 11:24:12 -05:00
2023-11-27 12:29:47 -06:00
- Org
- Single Owner
- All permissions Managers have
- Org Perms
- Toggle the active state
- Delete
- Rename
- Add and remove org managers
- Transfer ownership (member must be a manager of the org)
- Managers
- Group Perms
- Delete
- Create
- Rename
- Toggle active state
- Manage group users
- Manage group moderators
- Manage group tags
- Manage group names
- Tag Perms
- Delete
- Create
- Rename
- Groups
2024-02-09 13:26:32 -06:00
- Group
2023-11-27 12:29:47 -06:00
- Notes
- Members
- Group Perms
- Manage Users (Add or Remove Users)
- Manage Moderators (Allow other users to manage the group)
- Tags
- Must be a tag that exists in the Org (reference a tag table)
- Game Perms
- Squad
- Reserve
- Demos
- Kick
- Ban
- Etc.
2023-11-01 11:24:12 -05:00
*** Users
2023-11-27 12:29:47 -06:00
- Table Name: =users=
2024-02-09 13:26:32 -06:00
| Key | Type | Constraints | Description |
|--------------|-----------|--------------------------|-------------------|
| =id= | ~UUID4~ | ~PRIMARY KEY~ | |
| =steam64= | ~DECIMAL~ | ~UNIQUE~ | Steam64 ID |
| =playfab_id= | ~TEXT~ | ~UNIQUE~ | Master Playfab ID |
| =discord_id= | ~DECIMAL~ | ~UNIQUE~ | |
| =superuser= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | |
2023-11-01 11:24:12 -05:00
*** Organizations
2023-11-27 12:29:47 -06:00
- Table Name: =orgs=
| Key | Type | Constraints | Description |
|---------------------|---------------|-------------------------|-------------|
| =id= | ~UUID4~ | ~PRIMARY KEY~ | |
| =name= | ~VARCHAR(32)~ | ~UNIQUE NOT NULL~ | |
| =owner_id= | ~UUID4~ | ~REFERENCES users(id)~ | |
| =discord_server_id= | ~DECIMAL~ | | |
| =active= | ~BOOLEAN~ | ~NOT NULL DEFAULT true~ | |
**** Org Managers
- Table Name: =org_managers=
| Key | Type | Constraints | Description |
|-----------|-----------|------------------------------------------|-------------|
| =id= | ~UUID4~ | ~PRIMARY KEY~ | |
| =user_id= | ~DECIMAL~ | ~REFERENCES users(id) ON DELETE CASCADE~ | |
| =org_id= | ~UUID4~ | ~REFERENCES orgs(id) ON DELETE CASCADE~ | |
| =active= | ~BOOLEAN~ | ~NOT NULL DEFAULT true~ | |
Additional Constraints:
- ~UNIQUE(user_id, org_id)~
**** Tags
- Table Name: =org_tags=
| Key | Type | Constraints | Description |
|----------|---------------|----------------------------------|-------------|
| =id= | ~UUID4~ | ~PRIMARY KEY~ | |
| =name= | ~VARCHAR(32)~ | ~UNIQUE (name, org_id) NOT NULL~ | |
| =org_id= | ~UUID4~ | ~REFERENCES orgs(id)~ | |
**** Groups
- Table Name: =org_groups=
| Key | Type | Constraints | Description |
|----------|---------------|-----------------------------------------|-------------|
| =id= | ~UUID4~ | ~PRIMARY KEY~ | |
| =name= | ~VARCHAR(32)~ | ~NOT NULL UNIQUE(name,org_id)~ | |
| =org_id= | ~UUID4~ | ~REFERENCES orgs(id) ON DELETE CASCADE~ | |
| =active= | ~BOOLEAN~ | ~NOT NULL DEFAULT true~ | |
- Additional Constraints
- ~UNIQUE (name, org_id)~
***** Group Tags
- Table Name: =org_group_tags=
| Key | Type | Constraints | Description |
|------------|---------|-----------------------------------------------|-------------|
| =id= | ~UUID4~ | ~PRIMARY KEY~ | |
| =group_id= | ~UUID4~ | ~REFERENCES org_groups(id) ON DELETE CASCADE~ | |
| =tag_id= | ~UUID4~ | ~REFERENCES org_tags(id) ON DELETE CASCADE~ | |
- Additional Constraints
- ~UNIQUE (group_id, tag_id)~
***** Group Notes
- Table Name: =org_group_notes=
| Key | Type | Constraints | Description |
|------------|----------------|------------------------------------------------------|-------------|
| =id= | ~UUID4~ | ~PRIMARY KEY~ | |
| =group_id= | ~UUID4~ | ~UNIQUE REFERENCES org_groups(id) ON DELETE CASCADE~ | |
| =note= | ~VARCHAR(512)~ | ~NOT NULL~ | |
***** Group Members
- Table Name: =org_group_members=
2024-02-09 13:26:32 -06:00
| Key | Type | Constraints | Description |
|------------------------|-----------|-----------------------------------------------|----------------------------------------------------------------------|
| =id= | ~UUID4~ | ~PRIMARY KEY~ | |
| =user_id= | ~DECIMAL~ | ~REFERENCES users(id) ON DELETE CASCADE~ | |
| =group_id= | ~UUID4~ | ~REFERENCES org_groups(id) ON DELETE CASCADE~ | |
| =manage_users= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to add or remove members from group |
| =manage_mods= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to add or remove moderators to group |
| =manage_remote_import= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to set URL to import members from |
| =owner= | ~BOOLEAN~ | ~NOT NULL DEFAULT false UNIQUE~ | Has all permissions, cannot be removed from the group by a moderator |
2023-11-27 12:29:47 -06:00
- Additional Constraints
- ~UNIQUE (user_id, group_id)~
***** Group Squad Details
- Table Name: =org_group_squad_details=
| Key | Type | Constraints | Description |
|---------------------------|----------------|------------------------------------------------------|------------------------------------------------------------------------------------|
| =id= | ~UUID4~ | ~PRIMARY KEY~ | |
| =group_id= | ~UUID4~ | ~REFERENCES org_groups(id) UNIQUE ON DELETE CASCADE~ | |
| =remote_admin_list= | ~VARCHAR(256)~ | | |
| =remote_admin_list_group= | ~VARCHAR(32)~ | | |
| =perm_changemap= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to change the current map |
| =perm_pause= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to pause server gameplay |
| =perm_cheat= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to use server cheat commands |
| =perm_private= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to password protect the server |
| =perm_balance= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to ignore team balance |
| =perm_chat= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to access admin chat and make server broadcasts |
| =perm_kick= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to kick players |
| =perm_ban= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to ban players |
| =perm_config= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to change server config |
| =perm_cameraman= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to admin spectate mode |
| =perm_immune= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to cannot be kicked / banned |
| =perm_manageserver= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to shutdown server |
| =perm_featuretest= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to any features added for testing by dev team |
| =perm_reserve= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to reserve slot |
| =perm_demos= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to record Demos on the server side via admin commands |
| =perm_clientdemos= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to record Demos on the client side via commands or the replay UI |
| =perm_debug= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to Show admin stats command and other debugging info |
| =perm_teamchange= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to no timer limits on team change |
| =perm_forceteamchange= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to can issue the ForceTeamChange command |
| =perm_canseeadminchat= | ~BOOLEAN~ | ~NOT NULL DEFAULT false~ | Allowed to this group can see the admin chat and teamkill/admin-join notifications |