aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-01-19 19:37:28 +0200
committertranstrike <transtrike@gmail.com>2021-01-19 19:37:28 +0200
commitf9d6e76049aad823aaa8cb500520c7d3a7ad67e2 (patch)
treee787528f1ca793e34302d12a9514b4416a04a399 /src
parent84961acf2520bf7df3dab8c38de287a62313253d (diff)
downloadDevHive-f9d6e76049aad823aaa8cb500520c7d3a7ad67e2.tar
DevHive-f9d6e76049aad823aaa8cb500520c7d3a7ad67e2.tar.gz
DevHive-f9d6e76049aad823aaa8cb500520c7d3a7ad67e2.zip
Copied auth method from Update to Patch
Diffstat (limited to 'src')
-rw-r--r--src/DevHive.Web/Controllers/UserController.cs5
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)