diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs index 8ef8466..7f1df81 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs @@ -416,6 +416,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins new Claim(ClaimAttributes.phone,user?.Phone??""), new Claim(ClaimAttributes.logtime,timeLogin), new Claim(ClaimAttributes.limits,limits), + new Claim(ClaimAttributes.IsAdmin,user.IsAdmin?"true":"false"), new Claim(ClaimAttributes.personType,user?.ChatPersonType.ToString()!) }); @@ -484,6 +485,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins await _appUserRepository.UpdateAsync(user); } var authLoginOutput = Mapper.Map(user); + authLoginOutput.IsAdmin = isAdmin.IsAdmin; var token = await GetToken(authLoginOutput); diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs index d3cbd97..7046f50 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs @@ -412,7 +412,13 @@ namespace ATS.NonCustodial.Application.Impl.Business /// private async Task> GetExpression(AppEarlyWarningGetPageInput pageInput, IQueryable query) { - var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); + var limits = User.limits; + var IsAdmin = User.IsAdmin; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .WhereIf((!IsAdmin),w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + var caseIds = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + //var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); query = query.Where(w => caseIds.Contains(w.CaseId)) .WhereIf(pageInput.KeyWord.NotNull(), w => w.Title.Contains(pageInput.KeyWord) || w.CaseName.Contains(pageInput.KeyWord)) diff --git a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Auth/Output/AuthLoginOutput.cs b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Auth/Output/AuthLoginOutput.cs index 4a48de3..625637d 100644 --- a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Auth/Output/AuthLoginOutput.cs +++ b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Auth/Output/AuthLoginOutput.cs @@ -80,5 +80,10 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Auth.Output /// 查询界限 /// public string? limits { get; set; } + + /// + /// 是否是Admin + /// + public bool IsAdmin { get; set; } } } \ No newline at end of file diff --git a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs index 17d3654..4b42b87 100644 --- a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs +++ b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs @@ -91,5 +91,10 @@ namespace ATS.NonCustodial.Shared.Common.Auth /// 查询界限 /// public const string limits = "limits"; + + /// + /// 是否是Admin + /// + public const string IsAdmin = "false"; } } \ No newline at end of file diff --git a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs index 65d1d02..16cfb2b 100644 --- a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs +++ b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs @@ -57,6 +57,11 @@ namespace ATS.NonCustodial.Shared.Common.Auth /// string limits { get; } + /// + /// 是否管理员 + /// + bool IsAdmin { get; } + /// /// 租户Id /// diff --git a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs index 17ca193..05b2b91 100644 --- a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs +++ b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs @@ -176,6 +176,24 @@ namespace ATS.NonCustodial.Shared.Common.Auth } } + /// + /// 是否管理员 + /// + public bool IsAdmin + { + get + { + var name = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.IsAdmin); + + if (name != null && name.Value.NotNull()) + { + return name.Value=="true"; + } + + return false; + } + } + /// /// 租户Id ///