Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Implement Mastodon-compatible roles #3136

Conversation

VyrCossont
Copy link
Contributor

@VyrCossont VyrCossont commented Jul 24, 2024

Description

  • 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)

Closes #3115

Comments

We don't have or need Mastodon's elaborate custom permissions, but it costs us very little to be API-compatible with it in this case.

Implementing Account.roles is not strictly necessary for the feature request, but is closely adjacent and will make it easier for me to implement role badges in Feditext.

Checklist

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have not leveraged AI to create the proposed changes.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

- `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)
@VyrCossont VyrCossont force-pushed the issue-3115-role-permission-bits branch from 42b2183 to bca66da Compare July 24, 2024 15:54
@NyaaaWhatsUpDoc
Copy link
Member

a few comments but otherwise great :)

@VyrCossont VyrCossont merged commit fd83777 into superseriousbusiness:main Jul 31, 2024
2 checks passed
@VyrCossont VyrCossont deleted the issue-3115-role-permission-bits branch July 31, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Admin role permission bitmask
2 participants