1
0
zhontai 2 rokov pred
rodič
commit
05f1f12685

+ 16 - 0
src/hosts/ZhonTai.Host/Properties/launchSettings.json

@@ -1,13 +1,29 @@
 {
+  "iisSettings": {
+    "windowsAuthentication": false,
+    "anonymousAuthentication": true,
+    "iisExpress": {
+      "applicationUrl": "http://localhost:8000"
+    }
+  },
   "profiles": {
     "ZhonTai.Host": {
       "commandName": "Project",
       "launchBrowser": true,
+      "dotnetRunMessages": true,
       //"launchUrl": "swagger",
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development"
       },
       "applicationUrl": "http://localhost:8000"
+    },
+    "IIS Express": {
+      "commandName": "IISExpress",
+      "launchBrowser": true,
+      "launchUrl": "",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
     }
   }
 }

+ 13 - 12
src/platform/ZhonTai.Admin/Core/Db/DBServiceCollectionExtensions.cs

@@ -14,6 +14,7 @@ using System.Collections.Concurrent;
 using System.Reflection;
 using ZhonTai.Admin.Domain.User;
 using ZhonTai.Admin.Domain.Role;
+using System.Diagnostics;
 
 namespace ZhonTai.Admin.Core.Db;
 
@@ -76,6 +77,17 @@ public static class DBServiceCollectionExtensions
             //软删除过滤器
             fsql.GlobalFilter.ApplyOnly<IDelete>(FilterNames.Delete, a => a.IsDeleted == false);
 
+            //租户过滤器
+            if (appConfig.Tenant)
+            {
+                fsql.GlobalFilter.ApplyOnlyIf<ITenant>(FilterNames.Tenant, () => user?.Id > 0, a => a.TenantId == user.TenantId);
+            }
+
+            //数据权限过滤器,CurrentUser动态查询无法禁用过滤器
+            //fsql.GlobalFilter.ApplyOnlyIf<IData>(FilterNames.Data,
+            //    () => user?.Id > 0 && user.Type == UserType.DefaultUser && user.CurrentUser?.DataScope != DataScope.All,
+            //    a => a.OwnerId == user.Id || user.CurrentUser.OrgIds.Contains(a.CreatedOrgId.Value));
+
             //配置实体
             DbHelper.ConfigEntity(fsql, appConfig);
 
@@ -139,17 +151,6 @@ public static class DBServiceCollectionExtensions
 
             #endregion 监听Curd操作
 
-            //租户过滤器
-            if (appConfig.Tenant)
-            {
-                fsql.GlobalFilter.ApplyOnly<ITenant>(FilterNames.Tenant, a => a.TenantId == user.TenantId);
-            }
-
-            //数据权限过滤器
-            //fsql.GlobalFilter.ApplyOnlyIf<IData>(FilterNames.Data,
-            //    () => user.Type == UserType.DefaultUser && user.CurrentUser?.DataScope != DataScope.All,
-            //    a => a.OwnerId == user.Id || user.CurrentUser.OrgIds.Contains(a.CreatedOrgId.Value));
-
             return fsql;
         });
 
@@ -184,7 +185,7 @@ public static class DBServiceCollectionExtensions
                     #endregion 监听所有命令
 
                     var fsql = freeSqlBuilder.Build();
-                     
+
                     #region 监听Curd操作
 
                     if (dbConfig.Curd)

+ 2 - 2
src/platform/ZhonTai.Admin/Tools/Captcha/SlideJigsawCaptchaTool.cs

@@ -224,7 +224,7 @@ public class SlideJigsawCaptchaTool : ICaptchaTool
             }
         };
 
-        var key = string.Format(captchaKey, token);
+        var key = captchaKey + token;
         await _cache.SetAsync(key, blockPoint.X, TimeSpan.FromMinutes(5));
 
         return captchaData;
@@ -241,7 +241,7 @@ public class SlideJigsawCaptchaTool : ICaptchaTool
         {
             return false;
         }
-        var key = string.Format(input.CaptchaKey, input.Token);
+        var key = input.CaptchaKey + input.Token;
         if (await _cache.ExistsAsync(key))
         {
             try

+ 0 - 10
src/platform/ZhonTai.Admin/ZhonTai.Admin.xml

@@ -2694,16 +2694,6 @@
             用户
             </summary>
         </member>
-        <member name="P:ZhonTai.Admin.Domain.User.UserEntity.OwnerId">
-            <summary>
-            拥有者Id
-            </summary>
-        </member>
-        <member name="P:ZhonTai.Admin.Domain.User.UserEntity.CreatedOrgId">
-            <summary>
-            创建者部门Id
-            </summary>
-        </member>
         <member name="P:ZhonTai.Admin.Domain.User.UserEntity.TenantId">
             <summary>
             租户Id

+ 2 - 2
src/tests/ZhonTai.Tests/ZhonTai.Tests.csproj

@@ -6,8 +6,8 @@
 	</PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.9" />
-    <PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.9" />
+    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.10" />
+    <PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.10" />
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
     <PackageReference Include="xunit" Version="2.4.2" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">