mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
Update wordpress scopes and add `session/scopes
` endpoint (#15366)
* Update wordpress scopes && add ``session/scopes`` endpointt * Fix failing spec * Add users#show scope to discourse_connect * Update app/controllers/session_controller.rb Co-authored-by: Roman Rizzi <rizziromanalejandro@gmail.com> Co-authored-by: Roman Rizzi <rizziromanalejandro@gmail.com>
This commit is contained in:
@ -598,6 +598,16 @@ class SessionController < ApplicationController
|
||||
}
|
||||
end
|
||||
|
||||
def scopes
|
||||
if is_api?
|
||||
key = request.env[Auth::DefaultCurrentUserProvider::HEADER_API_KEY]
|
||||
api_key = ApiKey.active.with_key(key).first
|
||||
render_serialized(api_key.api_key_scopes, ApiKeyScopeSerializer, root: 'scopes')
|
||||
else
|
||||
render body: nil, status: 404
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def normalized_login_param
|
||||
|
Reference in New Issue
Block a user