From 89e0cfd8741b6763ca04e90558bccf4c3c380cfa Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sat, 13 Apr 2024 13:25:10 +0200 Subject: [feature] Admin accounts endpoints; approve/reject sign-ups (#2826) * update settings panels, add pending overview + approve/deny functions * add admin accounts get, approve, reject * send approved/rejected emails * use signup URL * docs! * email * swagger * web linting * fix email tests * wee lil fixerinos * use new paging logic for GetAccounts() series of admin endpoints, small changes to query building * shuffle useAccountIDIn check *before* adding to query * fix parse from toot react error * use `netip.Addr` * put valid slices in globals * optimistic updates for account state --------- Co-authored-by: kim --- internal/api/model/admin.go | 49 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'internal/api/model/admin.go') diff --git a/internal/api/model/admin.go b/internal/api/model/admin.go index ca84ffd88..637ab0ed7 100644 --- a/internal/api/model/admin.go +++ b/internal/api/model/admin.go @@ -229,3 +229,52 @@ type DebugAPUrlResponse struct { // may be an error, may be both! ResponseBody string `json:"response_body"` } + +// AdminGetAccountsRequest models a request +// to get an admin view of one or more +// accounts using given parameters. +// +// swagger:ignore +type AdminGetAccountsRequest struct { + // Filter for `local` or `remote` accounts. + Origin string + // Filter for `active`, `pending`, `disabled`, + // `silenced`, or `suspended` accounts. + Status string + // Filter for accounts with staff perms + // (users that can manage reports). + Permissions string + // Filter for users with these roles. + RoleIDs []string + // Lookup users invited by the account with this ID. + InvitedBy string + // Search for the given username. + Username string + // Search for the given display name. + DisplayName string + // Filter by the given domain. + ByDomain string + // Lookup a user with this email. + Email string + // Lookup users with this IP address. + IP string + // API version to use for this request (1 or 2). + // Set internally, not by callers. + APIVersion int +} + +// AdminAccountRejectRequest models a +// request to deny a new account sign-up. +// +// swagger:ignore +type AdminAccountRejectRequest struct { + // Comment to leave on why the account was denied. + // The comment will be visible to admins only. + PrivateComment string `form:"private_comment" json:"private_comment"` + // Message to include in email to applicant. + // Will be included only if send_email is true. + Message string `form:"message" json:"message"` + // Send an email to the applicant informing + // them that their sign-up has been rejected. + SendEmail bool `form:"send_email" json:"send_email"` +} -- cgit v1.2.3