spacebarchat / spacebarchat/server

Controlled accounts

Open
#171 4 comments 0 reactions 1 assignee View on GitHub

@FSG-Cat is already working on this.

Since Dec 25, 2021.

Enhancement Module: API Module: Specification
Dominant language
TypeScript
Stars
2.2k
Forks
323
Avg merge
14h 48m
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.
Companies, schools and parents would like ability to white- and black- list certain users to certain guilds,
channels and user groups. Bridge bots could also make use of this feature.

Describe the solution you'd like

  • Group whitelist/blacklist create (list of guilds and DM targets)
  • Group whitelist/blacklist fetch
  • Group whitelist/blacklist delete
  • Discriminator range reserve
  • Discriminator range unreserve
  • Create controlled account (#408)
  • Delete controlled account (#351)
  • Fetch all accounts controlled by self
  • Apply group white/blacklist to controlled user
  • Action in behalf of controlled user

Detailed description of the endpoints

Create controlled account: This endpoint shall create a controlled user account.
Parameters:

  • username: Name of the controlled account
  • tag: Discriminator of the controlled account
  • scope: Array of group white/blacklists to apply (if both white- and blacklists are present, then blacklist is subtracted from the whitelist)
  • controller: The user who controls the account (implicit in writes, returned in reads of the controlled user)
  • rights: Initial rights of the user
    Returns: If unauthorised to create a controlled user or apply one or more of the control flags, return 403 Forbidden.
    On success, return 200 OK.

Delete controlled account: This endpoint shall remove a controlled user account.

Parameters: same as /users/@me/delete, but controlled accounts cannot initiate account delete on their own.
Returns: If unauthorised to delete the user or apply one or more of the control flags, return 403 Forbidden. On attempt to delete a non-existent user in a discriminator range controlled by said user, return 400 Bad Request.
On success, return 200 OK.

Group white- and blacklist objects:
Parameters:

  • whitelist: if true, a whitelist, else, a blacklist
  • guilds: list of guilds
  • users: list of DM targets
  • roles: list of roles
    If unauthorised to create a controlled user or apply one or more of the control flags, return 403 Forbidden.
    On success, return 200 OK.

Group whitelist/blacklist create:

  • users: Array of user IDs to be affected initially
  • scope Group whitelist/blacklist object

If unauthorised to create a controlled user or apply one or more of the control flags, return 403 Forbidden.
On success, return 200 OK.

Discriminator range reserve: Reserve certain discriminators for a certain account controller. An account controller can only reserve discriminators for itself, not for other controllers.
Parameters:

  • include: a pair of discriminators, which denote an inclusive range
  • exclude: array of pairs of discriminators, which denote ranges to be excluded from above

If unauthorised to create a controlled user or apply one or more of the control flags, return 403 Forbidden.
On success, return 200 OK.

Discriminator range fetch: Returns the reservation by reservation ID. Discriminator range reservations shall be returnable by any user.

If unauthorised to create the reservation or attempts to re-reserve an already reserved range, return 403 Forbidden.
On success, return 200 OK.

Discriminator range delete: Deletes the reservation by reservation ID. Only the user that created the reservation can delete it.

If unauthorised to unreserve the range, return 403 Forbidden. On attempt to delete a non-existent reservation, return 400 Bad Request.
On success, return 200 OK.

Apply group white/blacklist to controlled user: Applies group scope limits to a given user.
Parameters:

  • user: User ID to apply the group white/blacklist.
  • scope Array of IDs of group white/blacklist to be applied. A user can have as many scopes applied as wanted.

Sub-tasks

  • Account controller configuration
  • Create/delete controlled account
  • Controlled account configuration
  • Act on behalf of a controlled account
  • Controlled account limits&exemptions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.