From 5dbdcb3f23a6077836f07342b78aea0537a85f64 Mon Sep 17 00:00:00 2001 From: Blake Erickson Date: Thu, 23 Feb 2023 08:33:29 -0700 Subject: [PATCH] FEATURE: Adding some more api scopes (#20420) Adds api scopes for - deleting a topic - deleting a post - listing tags --- app/models/api_key_scope.rb | 11 +++++++++++ config/locales/client.en.yml | 4 ++++ spec/requests/admin/api_controller_spec.rb | 1 + 3 files changed, 16 insertions(+) diff --git a/app/models/api_key_scope.rb b/app/models/api_key_scope.rb index f5aea4c94b5..957b145cc9e 100644 --- a/app/models/api_key_scope.rb +++ b/app/models/api_key_scope.rb @@ -31,6 +31,9 @@ class ApiKeyScope < ActiveRecord::Base actions: %w[topics#update topics#status], params: %i[topic_id category_id], }, + delete: { + actions: %w[topics#destroy], + }, read: { actions: %w[topics#show topics#feed topics#posts], params: %i[topic_id], @@ -55,6 +58,14 @@ class ApiKeyScope < ActiveRecord::Base actions: %w[posts#update], params: %i[id], }, + delete: { + actions: %w[posts#destroy], + }, + }, + tags: { + list: { + actions: %w[tags#index], + }, }, categories: { list: { diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 4bc3d13b707..886a8519720 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -4699,10 +4699,14 @@ en: read: Read a topic or a specific post in it. RSS is also supported. write: Create a new topic or post to an existing one. update: Update a topic. Change the title, category, tags, status, archetype, featured_link etc. + delete: Delete a topic. read_lists: Read topic lists like top, new, latest, etc. RSS is also supported. status: "Update a topic's status. Status: closed, archive, visisble, pinned. Enabled: true, false. Specify a category_id here and in the request payload to only allow status changes on topics in that category." posts: edit: Edit any post or a specific one. + delete: Delete a post. + tags: + list: List tags. categories: list: Get a list of categories. show: Get a single category by id. diff --git a/spec/requests/admin/api_controller_spec.rb b/spec/requests/admin/api_controller_spec.rb index b3e85bec6d1..18ce0996b86 100644 --- a/spec/requests/admin/api_controller_spec.rb +++ b/spec/requests/admin/api_controller_spec.rb @@ -423,6 +423,7 @@ RSpec.describe Admin::ApiController do "users", "email", "posts", + "tags", "uploads", "user_status", "global",