Skip to content

Commit

Permalink
修改返回用户信息形式
Browse files Browse the repository at this point in the history
  • Loading branch information
xxred committed Sep 30, 2019
1 parent 4ef0c67 commit cf4bff2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
19 changes: 18 additions & 1 deletion Easy.Admin/Areas/Admin/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,24 @@ public ApiResult GetUserInfo()
return ApiResult.Err("用户类型错误", 500);
}

return ApiResult.Ok(identity);
var data = new
{
identity.Avatar,
identity.DisplayName,
identity.ID,
identity.Name,
identity.RoleID,
identity.RoleIDs,
identity.Sex,
Roles = identity.Roles.Select(s => new
{
s.ID,
s.Name,
s.Permission
})
};

return ApiResult.Ok(data);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Easy.Admin/Configuration/AuthenticationConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static IServiceCollection ConfigAuthentication(this IServiceCollection se
return services;
}

private static void ConfigureJwtBearerOptions(JwtBearerAuthenticationOptions options, IConfiguration configuration)
public static void ConfigureJwtBearerOptions(JwtBearerAuthenticationOptions options, IConfiguration configuration)
{
options.SaveToken = true;

Expand Down
2 changes: 1 addition & 1 deletion Easy.Admin/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void Configure(IApplicationBuilder app)
app.UseSwaggerUI(c =>
{
var oAuthConfiguration = app.ApplicationServices.GetRequiredService<OAuthConfiguration>();
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Easy.Admin API V1");
c.SwaggerEndpoint("/swagger/v1/swagger.json", Configuration["ApiTitle"] ?? "EasyAdmin API");
//c.InjectJavascript("/swagger.js");//注入js
if (!oAuthConfiguration.Authority.IsNullOrEmpty())
Expand Down

0 comments on commit cf4bff2

Please sign in to comment.