summaryrefslogtreecommitdiff
path: root/internal/api/model/admin.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-04-13 13:25:10 +0200
committerLibravatar GitHub <noreply@github.com>2024-04-13 13:25:10 +0200
commit89e0cfd8741b6763ca04e90558bccf4c3c380cfa (patch)
tree5858ada73473816fa1982f12717b66996d163f9d /internal/api/model/admin.go
parent[performance] update GetAccountsByIDs() to use the new multi cache loader end... (diff)
downloadgotosocial-89e0cfd8741b6763ca04e90558bccf4c3c380cfa.tar.xz
[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 <grufwub@gmail.com>
Diffstat (limited to 'internal/api/model/admin.go')
-rw-r--r--internal/api/model/admin.go49
1 files changed, 49 insertions, 0 deletions
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"`
+}