diff options
| author | transtrike <transtrike@gmail.com> | 2020-12-16 10:23:15 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2020-12-16 10:23:15 +0200 |
| commit | d80b44003ca03cd09bf28278bf2e243581c00332 (patch) | |
| tree | 759aedce339e9e467c23bedea1464e3c2384ae35 /src/DevHive.Web/Controllers/UserController.cs | |
| parent | dc27cec6b3dd631c0f9a4e482743a053cf766df6 (diff) | |
| download | DevHive-d80b44003ca03cd09bf28278bf2e243581c00332.tar DevHive-d80b44003ca03cd09bf28278bf2e243581c00332.tar.gz DevHive-d80b44003ca03cd09bf28278bf2e243581c00332.zip | |
Fixed GetById to return only public info
Diffstat (limited to 'src/DevHive.Web/Controllers/UserController.cs')
| -rw-r--r-- | src/DevHive.Web/Controllers/UserController.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/DevHive.Web/Controllers/UserController.cs b/src/DevHive.Web/Controllers/UserController.cs index f241409..74eccd4 100644 --- a/src/DevHive.Web/Controllers/UserController.cs +++ b/src/DevHive.Web/Controllers/UserController.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using AutoMapper; +using DevHive.Data.Models; using DevHive.Data.Repositories; using DevHive.Services.Models.Identity.User; using DevHive.Services.Options; @@ -46,7 +47,9 @@ namespace DevHive.Web.Controllers [HttpGet] public async Task<IActionResult> GetById(Guid id) { - return await this._userService.GetUserById(id); + UserServiceModel serviceModel = await this._userService.GetUserById(id); + + return new OkObjectResult(this._userMapper.Map<UserWebModel>(serviceModel)); } //Update @@ -62,7 +65,7 @@ namespace DevHive.Web.Controllers //Delete [HttpDelete] - [Authorize] + [Authorize(Roles = Role.DefaultRole)] public async Task<IActionResult> Delete(Guid id) { return await this._userService.DeleteUser(id); |
