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:
Angus McLeod
2022-05-02 17:15:32 +02:00
committed by GitHub
parent fad94160c7
commit 9fc3d46003
7 changed files with 54 additions and 4 deletions

View File

@ -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