Return the user's role in login and user blueprints (#133)

This commit is contained in:
Justin Edmund 2023-09-09 02:29:32 -07:00 committed by GitHub
parent 0cf1e629bf
commit f8815043e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -4,7 +4,7 @@ module Api
module V1
class UserBlueprint < ApiBlueprint
view :minimal do
fields :username, :language, :private, :gender, :theme
fields :username, :language, :private, :gender, :theme, :role
field :avatar do |user|
{
picture: user.picture,

View file

@ -25,7 +25,8 @@ class TokensController < Doorkeeper::TokensController
### Or if you want to just append user using 'as_json'
body[:user] = {
id: user.id,
username: user.username
username: user.username,
role: user.role
}
end