From 653548be2498e6da1bf78ad985993ededf3cfeac Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 21 Mar 2024 17:32:45 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=90=A5=E4=B8=9A=E7=82=B9=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=8E=A7=E5=88=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/BusinessPlacePermissionsService.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Src/Dlhis.Basic/Places/Services/Implements/BusinessPlacePermissionsService.cs b/Src/Dlhis.Basic/Places/Services/Implements/BusinessPlacePermissionsService.cs index 13af5110..6b0cd8e2 100644 --- a/Src/Dlhis.Basic/Places/Services/Implements/BusinessPlacePermissionsService.cs +++ b/Src/Dlhis.Basic/Places/Services/Implements/BusinessPlacePermissionsService.cs @@ -55,11 +55,22 @@ public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService var role = _currentUser.GetUserClaim(ClaimTypes.Role); var isAdmin = role == "admin" || role == "tenant-admin"; - var codes = await _dbContext.Queryable() - .WhereIF(!isAdmin, x => x.ManagerUserId == userId) + var codes = new List(); + if (isAdmin) + { + codes = await _dbContext.Queryable() + .Select(x => x.Code) + .ToListAsync(); + } + else + { + codes = await _dbContext.Queryable() + .Where(x => x.ManagerUserId == userId) .Select(x => x.BusinessPlaceCode) .Distinct() .ToListAsync(); + } + return await _dbContext.Queryable() .Where(x => codes.Contains(x.Code))