浏览代码

Check for private route

BE_dev
bronjaermin 2 年前
父节点
当前提交
ead1c97390
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6
    0
      Diligent.WebAPI.Business/Services/CategoryService.cs

+ 6
- 0
Diligent.WebAPI.Business/Services/CategoryService.cs 查看文件

@@ -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)
{

正在加载...
取消
保存