Ver código fonte

Merge branch 'release' of http://git.12345lm.cn/Fengwo/hotline into release

qinchaoyue 6 meses atrás
pai
commit
d557b36955

+ 2 - 17
src/Hotline.Api/Controllers/OldHotlineController.cs

@@ -1,4 +1,5 @@
-using Fw.Utility.ConfigClient;
+using DocumentFormat.OpenXml.Spreadsheet;
+using Fw.Utility.ConfigClient;
 using Hotline.Api.Filter;
 using Hotline.Application.Identity;
 using Hotline.Application.Systems;
@@ -74,7 +75,6 @@ namespace Hotline.Api.Controllers
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
-        [AllowAnonymous]
         [HttpPost("loing-oldtonew")]
         [LogFilter("",false)]
         public async Task<string> HotlineLoginOldToNew([FromBody] HotlineLoginOldToNewDto dto)
@@ -97,7 +97,6 @@ namespace Hotline.Api.Controllers
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
-        [AllowAnonymous]
         [HttpGet("ishas_canhandler")]
         public async Task<bool> IsHasCanHandler([FromQuery] HotlineLoginOldToNewDto dto)
         {
@@ -114,20 +113,6 @@ namespace Hotline.Api.Controllers
             var isHas = false;
 
             var (isAdmin, isCenter, user) = await _identityAppService.IsCheckAdmin(dto.UserName);
-            _sessionContextProvider.SetContext(new TempSessionContext
-            {
-                UserId = user.Id,
-                UserName = user.Name,
-                Phone = user.PhoneNo,
-                Roles = user.Roles.Select(d => d.Name).ToArray(),
-                OrgId = user.OrgId,
-                OrgName = user.Organization.Name,
-                OrgLevel = user.Organization.Level,
-                OrgAreaCode = user.Organization.AreaCode,
-                OrgAreaName = user.Organization.AreaName,
-                OrgIsCenter = isCenter,
-                AreaId = user.AreaId,
-            });
             List<string> Roles = user.Roles.Select(x => x.Name).ToList();
             if (isCenter)
             {

+ 2 - 2
src/Hotline.Repository.SqlSugar/DataPermissions/DataPermissionFilterBuilder.cs

@@ -12,10 +12,10 @@ namespace Hotline.Repository.SqlSugar.DataPermissions;
 public class DataPermissionFilterBuilder : IDataPermissionFilterBuilder, IScopeDependency
 {
 
-    public DataPermissionFilterBuilder(ISessionContextProvider sessionContextProvider, IDataPermissionManager dataPermissionManager)
+    public DataPermissionFilterBuilder(ISessionContext sessionContext, IDataPermissionManager dataPermissionManager)
     {
         DataPermissionManager = dataPermissionManager;
-        SessionContext = sessionContextProvider.SessionContext;
+        SessionContext = sessionContext;
     }
 
     public ISessionContext SessionContext { get; }

+ 0 - 48
src/Hotline/Authentications/TempSessionContext.cs

@@ -1,48 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using XF.Domain.Authentications;
-
-namespace Hotline.Authentications
-{
-    public class TempSessionContext: ISessionContext
-    {
-        /// <summary>
-        /// Id of current tenant or null for host
-        /// </summary>
-        public string? UserId { get; init; }
-
-        /// <summary>
-        /// Id of current user or throw Exception for guest
-        /// </summary>
-        /// <exception cref="AuthenticationException"></exception>
-        public string RequiredUserId => UserId ?? throw new ArgumentNullException();
-        public string? UserName { get; init; }
-        public string? Phone { get; init; }
-
-        /// <summary>
-        /// Roles
-        /// </summary>
-        public string[] Roles { get; init; }
-        public string? OrgId { get; init; }
-        public string RequiredOrgId => OrgId ?? throw new ArgumentNullException();
-        public string? OrgName { get; init; }
-        public int OrgLevel { get; init; }
-        public string? OrgAreaCode { get; init; }
-        public bool OrgIsCenter { get; init; }
-
-        /// <summary>
-        /// 部门行政区划名称
-        /// </summary>
-        public string? OrgAreaName { get; init; }
-        public string? AreaId { get; init; }
-        public string? ClientId { get; init; }
-
-        /// <summary>
-        /// 工号
-        /// </summary>
-        public string? StaffNo { get; init; }
-    }
-}