diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2020-12-11 21:06:18 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2020-12-11 21:06:18 +0200 |
| commit | 62c14b8cb87135d2c2bbb86b6bbb480be6a91bbd (patch) | |
| tree | fdf73e647b448e179d87edcfc0beb450f390d7ee /API/Controllers/UserController.cs | |
| parent | 09aeb13a95ab573b05813ba563c322e854540c3e (diff) | |
| download | DevHive-62c14b8cb87135d2c2bbb86b6bbb480be6a91bbd.tar DevHive-62c14b8cb87135d2c2bbb86b6bbb480be6a91bbd.tar.gz DevHive-62c14b8cb87135d2c2bbb86b6bbb480be6a91bbd.zip | |
Added very simple and insecure roles
Diffstat (limited to 'API/Controllers/UserController.cs')
| -rw-r--r-- | API/Controllers/UserController.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 8c7a3c3..5b47f1c 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Authorization; namespace API.Controllers { + [Authorize] [ApiController] [Route("/api/[controller]")] public class UserController: ControllerBase @@ -20,6 +21,7 @@ namespace API.Controllers this._service = new UserService(context, mapper); } + [AllowAnonymous] [HttpPost] [Route("login")] public async Task<IActionResult> Login([FromBody] UserDTO userDTO) @@ -29,6 +31,7 @@ namespace API.Controllers //Create + [AllowAnonymous] [HttpPost] public async Task<IActionResult> Create([FromBody] UserDTO userDTO) { @@ -36,8 +39,8 @@ namespace API.Controllers } //Read - [Authorize] [HttpGet] + [Authorize(Roles = "Admin")] public async Task<IActionResult> GetById(int id) { return await this._service.GetUserById(id); |
