summaryrefslogtreecommitdiff
path: root/internal/api/model
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-11-15 10:19:32 +0100
committerLibravatar GitHub <noreply@github.com>2022-11-15 10:19:32 +0100
commita39a664525f55846dd5eea52fcc7009867835989 (patch)
tree33ba8c86bff8ea31853c1f52a92260d2909edcd4 /internal/api/model
parent[feature] Allow newly uploaded emojis to be placed in categories (#939) (diff)
downloadgotosocial-a39a664525f55846dd5eea52fcc7009867835989.tar.xz
[feature] Serialize local account role via API, and show it via web view (#1045)
* [feature] Add 'role' field to api serialization of local accounts * [chore] Add a bit of license text while I'm here * [frogend] render account role on same line as username in web view of profile * style tweaking on role badges, general profile header layout * profile stats wrapping * don't render standard 'user' role on web view Co-authored-by: f0x <f0x@cthu.lu>
Diffstat (limited to 'internal/api/model')
-rw-r--r--internal/api/model/account.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/api/model/account.go b/internal/api/model/account.go
index fb781d61f..c580d2b37 100644
--- a/internal/api/model/account.go
+++ b/internal/api/model/account.go
@@ -94,6 +94,10 @@ type Account struct {
CustomCSS string `json:"custom_css,omitempty"`
// Account has enabled RSS feed.
EnableRSS bool `json:"enable_rss,omitempty"`
+ // Role of the account on this instance.
+ // Omitted for remote accounts.
+ // example: user
+ Role AccountRole `json:"role,omitempty"`
}
// AccountCreateRequest models account creation parameters.
@@ -208,3 +212,16 @@ type AccountDeleteRequest struct {
// Can be the ID of the account owner, or the ID of an admin account.
DeleteOriginID string `form:"-" json:"-" xml:"-"`
}
+
+// AccountRole models the role of an account.
+//
+// swagger:enum accountRole
+// swagger:type string
+type AccountRole string
+
+const (
+ AccountRoleUser AccountRole = "user" // Standard user
+ AccountRoleModerator AccountRole = "moderator" // Moderator privileges
+ AccountRoleAdmin AccountRole = "admin" // Instance admin
+ AccountRoleUnknown AccountRole = "" // We don't know / remote account
+)