diff --git a/NanoNet.Services.AuthAPI/Controllers/AuthController.cs b/NanoNet.Services.AuthAPI/Controllers/AuthController.cs index a6c0915..f5abdd1 100644 --- a/NanoNet.Services.AuthAPI/Controllers/AuthController.cs +++ b/NanoNet.Services.AuthAPI/Controllers/AuthController.cs @@ -52,7 +52,7 @@ public async Task Login(LoginRequestDto requestDto) [HttpPost("AssignRole")] public async Task AssignRole(RegisterationRequestDto requestDto) { - var assignResponse = await _authService.AssignRole(requestDto.Email, requestDto.RoleName.ToUpper()); + var assignResponse = await _authService.AssignRole(requestDto.Email, requestDto.Role.ToUpper()); var responseDto = new ResponseDto(); diff --git a/NanoNet.Services.AuthAPI/Dtos/RegisterationRequestDto.cs b/NanoNet.Services.AuthAPI/Dtos/RegisterationRequestDto.cs index 4cc92af..4a4f63d 100644 --- a/NanoNet.Services.AuthAPI/Dtos/RegisterationRequestDto.cs +++ b/NanoNet.Services.AuthAPI/Dtos/RegisterationRequestDto.cs @@ -14,6 +14,6 @@ public class RegisterationRequestDto public string Password { get; set; } - public string RoleName { get; set; } = "Client"; + public string Role { get; set; } = "Client"; } } diff --git a/NanoNet.Services.CouponAPI/Controllers/CouponController.cs b/NanoNet.Services.CouponAPI/Controllers/CouponController.cs index 2e032df..12ae181 100644 --- a/NanoNet.Services.CouponAPI/Controllers/CouponController.cs +++ b/NanoNet.Services.CouponAPI/Controllers/CouponController.cs @@ -73,6 +73,7 @@ public ActionResult GetCouponByCode(string code) } [HttpPost] + [Authorize(Roles = "ADMIN")] public ActionResult AddCoupon([FromBody] CouponDto couponDto) { try @@ -92,6 +93,7 @@ public ActionResult AddCoupon([FromBody] CouponDto couponDto) } [HttpPut] + [Authorize(Roles = "ADMIN")] public ActionResult UpdateCoupon([FromBody] CouponDto couponDto) { try @@ -111,6 +113,7 @@ public ActionResult UpdateCoupon([FromBody] CouponDto couponDto) } [HttpDelete("{id}")] + [Authorize(Roles = "ADMIN")] public ActionResult DeleteCoupon(int id) { try diff --git a/NanoNet.Web/Controllers/AuthController.cs b/NanoNet.Web/Controllers/AuthController.cs index bce3887..0a29c66 100644 --- a/NanoNet.Web/Controllers/AuthController.cs +++ b/NanoNet.Web/Controllers/AuthController.cs @@ -20,7 +20,7 @@ public IActionResult Register() var list = new List() { new SelectListItem { Text = "Admin", Value = SD.RoleAdmin }, - new SelectListItem { Text = "User", Value = SD.RoleUser } + new SelectListItem { Text = "Client", Value = SD.RoleUser } }; ViewBag.RoleList = list; diff --git a/NanoNet.Web/Utility/SD.cs b/NanoNet.Web/Utility/SD.cs index aea9f63..7d3cbfa 100644 --- a/NanoNet.Web/Utility/SD.cs +++ b/NanoNet.Web/Utility/SD.cs @@ -9,7 +9,7 @@ public static class SD public const string RoleAdmin = "Admin"; - public const string RoleUser = "User"; + public const string RoleUser = "Client"; public const string TokenName = "JWTToken";