mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
Require permitted scopes when registering a client (#29718)
This commit is contained in:
@ -14,9 +14,19 @@ end
|
||||
|
||||
Fabricator(:user_api_key_scope)
|
||||
|
||||
Fabricator(:user_api_key_client_scope)
|
||||
|
||||
Fabricator(:user_api_key_client) do
|
||||
transient :scopes
|
||||
|
||||
client_id { SecureRandom.hex }
|
||||
application_name "some app"
|
||||
|
||||
after_create do |client, transients|
|
||||
if transients[:scopes].present?
|
||||
[*transients[:scopes]].each { |scope| client.scopes.create!(name: scope) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Fabricator(:readonly_user_api_key, from: :user_api_key) do
|
||||
|
Reference in New Issue
Block a user