aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web/Controllers/UserController.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2020-12-16 19:00:00 +0200
committertranstrike <transtrike@gmail.com>2020-12-16 19:00:00 +0200
commitfb2803789e012cda1aca4c5f8bef779923f5db61 (patch)
tree05a0e24af85915dc8698ebc3bdce6e934a73da4e /src/DevHive.Web/Controllers/UserController.cs
parente46bfcf0d9ef6e927b2922c63dacde9442fe82d3 (diff)
downloadDevHive-fb2803789e012cda1aca4c5f8bef779923f5db61.tar
DevHive-fb2803789e012cda1aca4c5f8bef779923f5db61.tar.gz
DevHive-fb2803789e012cda1aca4c5f8bef779923f5db61.zip
Authorization fixed
Diffstat (limited to 'src/DevHive.Web/Controllers/UserController.cs')
-rw-r--r--src/DevHive.Web/Controllers/UserController.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/DevHive.Web/Controllers/UserController.cs b/src/DevHive.Web/Controllers/UserController.cs
index f952355..80e1bde 100644
--- a/src/DevHive.Web/Controllers/UserController.cs
+++ b/src/DevHive.Web/Controllers/UserController.cs
@@ -14,6 +14,7 @@ namespace DevHive.Web.Controllers
{
[ApiController]
[Route("/api/[controller]")]
+ [Authorize(Roles = "User")]
public class UserController: ControllerBase
{
private readonly UserService _userService;
@@ -27,6 +28,7 @@ namespace DevHive.Web.Controllers
[HttpPost]
[Route("Login")]
+ [AllowAnonymous]
public async Task<IActionResult> Login([FromBody] LoginWebModel loginModel)
{
LoginServiceModel loginServiceModel = this._userMapper.Map<LoginServiceModel>(loginModel);
@@ -39,6 +41,7 @@ namespace DevHive.Web.Controllers
[HttpPost]
[Route("Register")]
+ [AllowAnonymous]
public async Task<IActionResult> Register([FromBody] RegisterWebModel registerModel)
{
RegisterServiceModel registerServiceModel = this._userMapper.Map<RegisterServiceModel>(registerModel);
@@ -61,7 +64,6 @@ namespace DevHive.Web.Controllers
//Update
[HttpPut]
- [Authorize(Roles = Role.DefaultRole)]
public async Task<IActionResult> Update(Guid id, [FromBody] UpdateUserWebModel updateModel)
{
UpdateUserServiceModel updateUserServiceModel = this._userMapper.Map<UpdateUserServiceModel>(updateModel);
@@ -76,7 +78,6 @@ namespace DevHive.Web.Controllers
//Delete
[HttpDelete]
- [Authorize(Roles = Role.DefaultRole)]
public async Task<IActionResult> Delete(Guid id)
{
await this._userService.DeleteUser(id);