FEATURE: Add an API key scopes for handling incoming email. (#11245)

Admins need to create a global API key if they want to use the mail-receiver. Let's add a scope for that.
This commit is contained in:
Roman Rizzi 2020-11-16 14:14:12 -03:00 committed by GitHub
parent aee5e80038
commit 689623ffc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -38,6 +38,9 @@ class ApiKeyScope < ActiveRecord::Base
sync_sso: { actions: %w[admin/users#sync_sso], params: %i[sso sig] },
show: { actions: %w[users#show], params: %i[username external_id] },
check_emails: { actions: %w[users#check_emails], params: %i[username] }
},
email: {
receive_emails: { actions: %w[admin/email#handle_mail] }
}
}

View File

@ -3735,6 +3735,8 @@ en:
sync_sso: Synchronize a user using SSO.
show: Obtain information about an user.
check_emails: List user emails.
mail:
receive_emails: Combine this scope with the mail-receiver to process incoming emails.
web_hooks:
title: "Webhooks"

View File

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