diff options
author | 2024-07-31 09:26:09 -0700 | |
---|---|---|
committer | 2024-07-31 09:26:09 -0700 | |
commit | fd837776e2aaf30f4ea973d65c9dfe0979988371 (patch) | |
tree | c2853d4bab55e1eccd91cbf48df4dd6279bc72d7 /docs/api | |
parent | [docs] Update system requirements, move things around a bit (#3157) (diff) | |
download | gotosocial-fd837776e2aaf30f4ea973d65c9dfe0979988371.tar.xz |
[feature] Implement Mastodon-compatible roles (#3136)
* Implement Mastodon-compatible roles
- `Account.role` should only be available through verify_credentials for checking current user's permissions
- `Account.role` now carries a Mastodon-compatible permissions bitmap and a marker for whether it should be shown to the public
- `Account.roles` added for *public* display roles (undocumented but stable since Mastodon 4.1)
- Web template now uses only public display roles (no user-visible change here, we already special-cased the `user` role)
* Handle verify_credentials case for default role
* Update JSON exact-match tests
* Address review comments
* Add blocks bit to admin permissions bitmap
Diffstat (limited to 'docs/api')
-rw-r--r-- | docs/api/swagger.yaml | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/docs/api/swagger.yaml b/docs/api/swagger.yaml index 102a00fbd..1d5b80ed1 100644 --- a/docs/api/swagger.yaml +++ b/docs/api/swagger.yaml @@ -304,6 +304,15 @@ definitions: x-go-name: Note role: $ref: '#/definitions/accountRole' + roles: + description: |- + Roles lists the public roles of the account on this instance. + Unlike Role, this is always available, but never includes permissions details. + Key/value omitted for remote accounts. + items: + $ref: '#/definitions/accountDisplayRole' + type: array + x-go-name: Roles source: $ref: '#/definitions/Source' statuses_count: @@ -333,6 +342,29 @@ definitions: type: object x-go-name: Account x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model + accountDisplayRole: + description: This is a subset of AccountRole. + properties: + color: + description: |- + Color is a 6-digit CSS-style hex color code with leading `#`, or an empty string if this role has no color. + Since GotoSocial doesn't use role colors, we leave this empty. + type: string + x-go-name: Color + id: + description: |- + ID of the role. + Not used by GotoSocial, but we set it to the role name, just in case a client expects a unique ID. + type: string + x-go-name: ID + name: + description: Name of the role. + type: string + x-go-name: Name + title: AccountDisplayRole models a public, displayable role of an account. + type: object + x-go-name: AccountDisplayRole + x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model accountExportStats: description: |- AccountExportStats models an account's stats @@ -448,9 +480,32 @@ definitions: x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model accountRole: properties: + color: + description: |- + Color is a 6-digit CSS-style hex color code with leading `#`, or an empty string if this role has no color. + Since GotoSocial doesn't use role colors, we leave this empty. + type: string + x-go-name: Color + highlighted: + description: |- + Highlighted indicates whether the role is publicly visible on the user profile. + This is always true for GotoSocial's built-in admin and moderator roles, and false otherwise. + type: boolean + x-go-name: Highlighted + id: + description: |- + ID of the role. + Not used by GotoSocial, but we set it to the role name, just in case a client expects a unique ID. + type: string + x-go-name: ID name: + description: Name of the role. type: string x-go-name: Name + permissions: + description: Permissions is a bitmap serialized as a numeric string, indicating which admin/moderation actions a user can perform. + type: string + x-go-name: Permissions title: AccountRole models the role of an account. type: object x-go-name: AccountRole @@ -2209,6 +2264,15 @@ definitions: x-go-name: Note role: $ref: '#/definitions/accountRole' + roles: + description: |- + Roles lists the public roles of the account on this instance. + Unlike Role, this is always available, but never includes permissions details. + Key/value omitted for remote accounts. + items: + $ref: '#/definitions/accountDisplayRole' + type: array + x-go-name: Roles source: $ref: '#/definitions/Source' statuses_count: |