FEATURE: adds uploads scope for API keys (#14941)

* FEATURE: adds uploads scope for API keys

* Add basic test, change "image" to "file"
This commit is contained in:
RogerBW 2021-11-22 17:49:08 +00:00 committed by GitHub
parent c891c44775
commit fd66df5997
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -35,6 +35,9 @@ class ApiKeyScope < ActiveRecord::Base
posts: {
edit: { actions: %w[posts#update], params: %i[id] }
},
uploads: {
create: { actions: %w[uploads#create] }
},
users: {
bookmarks: { actions: %w[users#bookmarks], params: %i[username] },
sync_sso: { actions: %w[admin/users#sync_sso], params: %i[sso sig] },

View File

@ -4193,6 +4193,8 @@ en:
wordpress: Necessary for the WordPress wp-discourse plugin to work.
posts:
edit: Edit any post or a specific one.
uploads:
create: Upload a new file.
users:
bookmarks: List user bookmarks. It returns bookmark reminders when using the ICS format.
sync_sso: Synchronize a user using DiscourseConnect.

View File

@ -237,7 +237,7 @@ describe Admin::ApiController do
scopes = response.parsed_body['scopes']
expect(scopes.keys).to contain_exactly('topics', 'users', 'email', 'posts', 'global')
expect(scopes.keys).to contain_exactly('topics', 'users', 'email', 'posts', 'uploads', 'global')
end
end
end