add: channels/messages scopes and api endpoints

This commit is contained in:
trisua 2025-06-13 22:07:36 -04:00
parent 8f16068a34
commit b29760d7ec
10 changed files with 195 additions and 63 deletions

View file

@ -70,6 +70,8 @@ pub enum AppScope {
UserCreateDrafts,
/// Create communities on behalf of the user.
UserCreateCommunities,
/// Create stacks on behalf of the user.
UserCreateStacks,
/// Delete posts owned by the user.
UserDeletePosts,
/// Delete messages owned by the user.
@ -98,12 +100,16 @@ pub enum AppScope {
UserManageNotifications,
/// Manage the user's requests.
UserManageRequests,
/// Manage the user's uploads.
UserManageUploads,
/// Edit posts created by the user.
UserEditPosts,
/// Edit drafts created by the user.
UserEditDrafts,
/// Vote in polls as the user.
UserVote,
/// React to posts on behalf of the user. Also allows the removal of reactions.
UserReact,
/// Join communities on behalf of the user.
UserJoinCommunities,
/// Permanently delete posts.
@ -126,6 +132,10 @@ pub enum AppScope {
CommunityTransferOwnership,
/// Read the membership of users in communities owned by the current user.
CommunityReadMemberships,
/// Create channels in the user's communities.
CommunityCreateChannels,
/// Manage channels in the user's communities.
CommunityManageChannels,
}
impl AppScope {
@ -164,9 +174,11 @@ impl AppScope {
"user-manage-blocks" => Self::UserManageBlocks,
"user-manage-notifications" => Self::UserManageNotifications,
"user-manage-requests" => Self::UserManageRequests,
"user-manage-uploads" => Self::UserManageUploads,
"user-edit-posts" => Self::UserEditPosts,
"user-edit-drafts" => Self::UserEditDrafts,
"user-vote" => Self::UserVote,
"user-react" => Self::UserReact,
"user-join-communities" => Self::UserJoinCommunities,
"mod-purge-posts" => Self::ModPurgePosts,
"mod-delete-posts" => Self::ModDeletePosts,
@ -178,6 +190,8 @@ impl AppScope {
"community-manage" => Self::CommunityManage,
"community-transfer-ownership" => Self::CommunityTransferOwnership,
"community-read-memberships" => Self::CommunityReadMemberships,
"community-create-channels" => Self::CommunityCreateChannels,
"community-manage-channels" => Self::CommunityManageChannels,
_ => continue,
})
}