Refactored all Policy strings into their own constant file.

This commit is contained in:
Joseph Milazzo 2020-12-24 10:21:59 -06:00
parent a40bc9e9f7
commit 793c13e1e6
4 changed files with 15 additions and 4 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using API.Constants;
using API.DTOs;
using API.Entities;
using API.Interfaces;
@ -50,7 +51,7 @@ namespace API.Controllers
// TODO: Need a way to store Roles in enum and configure from there
var role = registerDto.IsAdmin ? "Admin" : "Pleb";
var role = registerDto.IsAdmin ? PolicyConstants.AdminRole : PolicyConstants.PlebRole;
var roleResult = await _userManager.AddToRoleAsync(user, role);
if (!roleResult.Succeeded) return BadRequest(result.Errors);