diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-19 19:37:28 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-19 19:37:28 +0200 |
| commit | f9d6e76049aad823aaa8cb500520c7d3a7ad67e2 (patch) | |
| tree | e787528f1ca793e34302d12a9514b4416a04a399 /src/DevHive.Web/Controllers/UserController.cs | |
| parent | 84961acf2520bf7df3dab8c38de287a62313253d (diff) | |
| download | DevHive-f9d6e76049aad823aaa8cb500520c7d3a7ad67e2.tar DevHive-f9d6e76049aad823aaa8cb500520c7d3a7ad67e2.tar.gz DevHive-f9d6e76049aad823aaa8cb500520c7d3a7ad67e2.zip | |
Copied auth method from Update to Patch
Diffstat (limited to 'src/DevHive.Web/Controllers/UserController.cs')
| -rw-r--r-- | src/DevHive.Web/Controllers/UserController.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/DevHive.Web/Controllers/UserController.cs b/src/DevHive.Web/Controllers/UserController.cs index 7f4e80b..471d2bb 100644 --- a/src/DevHive.Web/Controllers/UserController.cs +++ b/src/DevHive.Web/Controllers/UserController.cs @@ -105,8 +105,11 @@ namespace DevHive.Web.Controllers } [HttpPatch] - public async Task<IActionResult> Patch(Guid id, [FromBody] JsonPatchDocument<User> jsonPatch) + public async Task<IActionResult> Patch(Guid id, [FromBody] JsonPatchDocument<User> jsonPatch, [FromHeader] string authorization) { + if (!await this._userService.ValidJWT(id, authorization)) + return new UnauthorizedResult(); + UserServiceModel userServiceModel = await this._userService.PatchUser(id, jsonPatch); if (userServiceModel == null) |
