From 72390e0230b64cd43fedf0ba8e17aba097568a4a Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期四, 26 六月 2025 16:36:13 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_UserService.cs | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_UserService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_UserService.cs" index 167b1d1..10a75dd 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_UserService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_UserService.cs" @@ -20,10 +20,15 @@ { private readonly IUnitOfWorkManage _unitOfWorkManage; private readonly ICacheService _cacheService; - public Sys_UserService(ISys_UserRepository repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService) : base(repository) + private readonly ISys_MenuService _menuService; + + public ISys_UserRepository Repository => BaseDal; + + public Sys_UserService(ISys_UserRepository repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, ISys_MenuService menuService) : base(repository) { _unitOfWorkManage = unitOfWorkManage; _cacheService = cacheService; + _menuService = menuService; } public WebResponseContent Login(LoginInfo loginInfo) @@ -49,6 +54,16 @@ UserInfo user = BaseDal.GetUserInfo(loginInfo.UserName, loginInfo.Password); if (user != null) { + object obj = _menuService.GetMenuActionList(user.RoleId); + if (obj is not IEnumerable<object> list) + { + return WebResponseContent.Instance.Error("鏃犵櫥褰曟潈闄�"); + } + if (!list.Any()) + { + return WebResponseContent.Instance.Error("鏃犵櫥褰曟潈闄�"); + } + string token = JwtHelper.IssueJwt(new TokenModelJwt() { UserId = user.UserId, @@ -76,6 +91,8 @@ public override WebResponseContent UpdateData(SaveModel saveModel) { + var role_Id = saveModel.MainData["role_Id"].ObjToInt(); + if (role_Id < App.User.RoleId) return WebResponseContent.Instance.Error("鏃犱慨鏀规潈闄�"); UpdateIgnoreColOnExecute = x => { return new List<string> @@ -131,7 +148,7 @@ /// </summary> /// <param name="parameters"></param> /// <returns></returns> - public WebResponseContent ModifyPwd(string oldPwd, string newPwd) + public WebResponseContent ModifyPwd(string oldPwd, string newPwd, int user_Id) { WebResponseContent content = WebResponseContent.Instance; oldPwd = oldPwd?.Trim(); @@ -144,6 +161,7 @@ if (newPwd.Length < 6) return WebResponseContent.Instance.Error("瀵嗙爜涓嶈兘灏戜簬6浣�"); int userId = App.User.UserId; + if (user_Id != userId && user_Id != 0) return WebResponseContent.Instance.Error("涓嶅彲淇敼鍏朵粬鐢ㄦ埛瀵嗙爜"); string userCurrentPwd = BaseDal.QueryFirst(x => x.User_Id == userId, s => s.UserPwd); string _oldPwd = oldPwd.EncryptDES(AppSecret.User); -- Gitblit v1.9.3