Procházet zdrojové kódy

Check for private route

BE_dev
bronjaermin před 3 roky
rodič
revize
ead1c97390
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  1. 6
    0
      Diligent.WebAPI.Business/Services/CategoryService.cs

+ 6
- 0
Diligent.WebAPI.Business/Services/CategoryService.cs Zobrazit soubor

var user = await _userManager.FindByIdAsync(userId.ToString()); var user = await _userManager.FindByIdAsync(userId.ToString());
var role = (await _userManager.GetRolesAsync(user))[0]; 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 (role == "SuperAdmin")
if (parentCategoryId == -1) if (parentCategoryId == -1)
{ {

Načítá se…
Zrušit
Uložit