From e3ee14488905fdd28376956ff80c4702ce0054f3 Mon Sep 17 00:00:00 2001 From: silverpill Date: Sun, 19 Mar 2023 19:20:36 +0000 Subject: [PATCH] Grant delete_any_post and delete_any_profile permissions to admin role --- CHANGELOG.md | 1 + docs/openapi.yaml | 2 ++ src/mastodon_api/accounts/types.rs | 2 ++ src/models/users/types.rs | 4 ++++ 4 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1edf2..7f6c830 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Documented valid role names for `set-role` command. +- Granted `delete_any_post` and `delete_any_profile` permissions to admin role. ### Fixed diff --git a/docs/openapi.yaml b/docs/openapi.yaml index fec57ff..1f1443a 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1782,6 +1782,8 @@ components: enum: - create_follow_request - create_post + - delete_any_post + - delete_any_profile - manage_subscription_options Signature: type: object diff --git a/src/mastodon_api/accounts/types.rs b/src/mastodon_api/accounts/types.rs index e6f1aab..027ff0e 100644 --- a/src/mastodon_api/accounts/types.rs +++ b/src/mastodon_api/accounts/types.rs @@ -84,6 +84,8 @@ impl ApiRole { match permission { Permission::CreateFollowRequest => "create_follow_request", Permission::CreatePost => "create_post", + Permission::DeleteAnyPost => "delete_any_post", + Permission::DeleteAnyProfile => "delete_any_profile", Permission::ManageSubscriptionOptions => "manage_subscription_options", }.to_string() diff --git a/src/models/users/types.rs b/src/models/users/types.rs index 774d6ff..9e26e12 100644 --- a/src/models/users/types.rs +++ b/src/models/users/types.rs @@ -29,6 +29,8 @@ pub struct DbInviteCode { pub enum Permission { CreateFollowRequest, CreatePost, + DeleteAnyPost, + DeleteAnyProfile, ManageSubscriptionOptions, } @@ -66,6 +68,8 @@ impl Role { Self::Admin => vec![ Permission::CreateFollowRequest, Permission::CreatePost, + Permission::DeleteAnyPost, + Permission::DeleteAnyProfile, Permission::ManageSubscriptionOptions, ], Self::ReadOnlyUser => vec![