数据范围枚举

This commit is contained in:
陈淳
2022-09-15 18:59:01 +08:00
parent 52b8bc8909
commit 0cc326836c
3 changed files with 22 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// 账户管理
/// </summary>
[ApiController]
[Authorize]
[Route("api/[controller]/[action]")]
public class AccountController : ControllerBase
{
@@ -41,6 +42,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<Result> RestCC()
{
var user= await _iUserService._repository.GetFirstAsync(u => u.UserName == "cc");
@@ -96,6 +98,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public Result Logout()
{
return Result.Success("安全登出成功!");

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Enum
{
public enum DataScopeEnum
{
All = 0,
Custom = 1,
Dept = 2,
DeptAndUnder = 3,
User = 4
}
}

View File

@@ -29,7 +29,8 @@ namespace Yi.Framework.WebCore
public static long GetUserIdInfo(this HttpContext httpContext)
{
return Convert.ToInt64(httpContext.User.Claims.FirstOrDefault(u => u.Type== JwtRegisteredClaimNames.Sid));
var p = httpContext;
return Convert.ToInt64(httpContext .User.Claims.FirstOrDefault(u => u.Type== JwtRegisteredClaimNames.Sid).Value);
}
/// <summary>