aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Web/Controllers')
-rw-r--r--src/DevHive.Web/Controllers/RoleController.cs2
-rw-r--r--src/DevHive.Web/Controllers/UserController.cs5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/DevHive.Web/Controllers/RoleController.cs b/src/DevHive.Web/Controllers/RoleController.cs
index 1e11ee1..610d370 100644
--- a/src/DevHive.Web/Controllers/RoleController.cs
+++ b/src/DevHive.Web/Controllers/RoleController.cs
@@ -6,11 +6,13 @@ using DevHive.Web.Models.Identity.Role;
using AutoMapper;
using DevHive.Services.Models.Identity.Role;
using System;
+using Microsoft.AspNetCore.Authorization;
namespace DevHive.Web.Controllers
{
[ApiController]
[Route("/api/[controller]")]
+ //[Authorize(Roles = "Admin")]
public class RoleController
{
private readonly RoleService _roleService;
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);