FEATURE: Introduce API scopes for badges.
This commit is contained in:
parent
f3508065a3
commit
44588255fc
|
@ -51,6 +51,15 @@ class ApiKeyScope < ActiveRecord::Base
|
||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
receive_emails: { actions: %w[admin/email#handle_mail] }
|
receive_emails: { actions: %w[admin/email#handle_mail] }
|
||||||
|
},
|
||||||
|
badges: {
|
||||||
|
create: { actions: %w[admin/badges#create] },
|
||||||
|
show: { actions: %w[badges#show] },
|
||||||
|
update: { actions: %w[admin/badges#update] },
|
||||||
|
delete: { actions: %w[admin/badges#destroy] },
|
||||||
|
list_user_badges: { actions: %w[user_badges#username], params: %i[username] },
|
||||||
|
assign_badge_to_user: { actions: %w[user_badges#create], params: %i[username] },
|
||||||
|
revoke_badge_from_user: { actions: %w[user_badges#destroy] },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4219,6 +4219,14 @@ en:
|
||||||
list: Get a list of users.
|
list: Get a list of users.
|
||||||
email:
|
email:
|
||||||
receive_emails: Combine this scope with the mail-receiver to process incoming emails.
|
receive_emails: Combine this scope with the mail-receiver to process incoming emails.
|
||||||
|
badges:
|
||||||
|
create: Create a new badge.
|
||||||
|
show: Obtain information about a badge.
|
||||||
|
update: Update a badge.
|
||||||
|
delete: Delete a badge.
|
||||||
|
list_user_badges: List user badges.
|
||||||
|
assign_badge_to_user: Assign a badge to a user.
|
||||||
|
revoke_badge_from_user: Revoke a badge from a user.
|
||||||
|
|
||||||
web_hooks:
|
web_hooks:
|
||||||
title: "Webhooks"
|
title: "Webhooks"
|
||||||
|
|
|
@ -237,7 +237,7 @@ describe Admin::ApiController do
|
||||||
|
|
||||||
scopes = response.parsed_body['scopes']
|
scopes = response.parsed_body['scopes']
|
||||||
|
|
||||||
expect(scopes.keys).to contain_exactly('topics', 'users', 'email', 'posts', 'uploads', 'global')
|
expect(scopes.keys).to contain_exactly('topics', 'users', 'email', 'posts', 'uploads', 'global', 'badges')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue