Explorar el Código

Check for private route

BE_dev
bronjaermin hace 2 años
padre
commit
ead1c97390
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6
    0
      Diligent.WebAPI.Business/Services/CategoryService.cs

+ 6
- 0
Diligent.WebAPI.Business/Services/CategoryService.cs Ver fichero

@@ -31,6 +31,12 @@ namespace Diligent.WebAPI.Business.Services
var user = await _userManager.FindByIdAsync(userId.ToString());
var role = (await _userManager.GetRolesAsync(user))[0];

if(parentCategoryId != -1)
{
var categories = await _context.UserCategories.Where(x => x.UserId == userId && x.CategoryId == parentCategoryId).ToListAsync();
if (categories.Count == 0) return null;
}

if (role == "SuperAdmin")
if (parentCategoryId == -1)
{

Cargando…
Cancelar
Guardar