From 680ccbedf08839143215f40dea5273dc2819100c Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 30 十月 2024 23:26:33 +0800
Subject: [PATCH] 优化WMS、WCS用户管理

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs"
index a3f689d..7526baa 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs"
@@ -167,7 +167,9 @@
             string message = "";
             try
             {
-                if (!GetAllChildren(App.User.RoleId).Exists(x => x.Id == roleId))
+                var RoleNodes = GetAllChildren(App.User.RoleId);
+                RoleNodes = RoleNodes.Where(x => x.Id != App.User.RoleId).ToList();
+                if (!RoleNodes.Exists(x => x.Id == roleId) /*&& !App.User.IsRoleIdSuperAdmin(App.User.RoleId)*/)
                     return WebResponseContent.Instance.Error("娌℃湁鏉冮檺淇敼姝よ鑹茬殑鏉冮檺淇℃伅");
                 //褰撳墠鐢ㄦ埛鐨勬潈闄�
                 List<Permissions> permissions = _MenuRepository.GetPermissions(App.User.RoleId);
@@ -212,9 +214,9 @@
 
                 }
                 //鏇存柊鏉冮檺
-                _RoleAuthRepository.UpdateData(updateAuths);
+                _RoleAuthRepository.UpdateData(updateAuths.Where(x => x.AuthId > 0).ToList());
                 //鏂板鐨勬潈闄�
-                _RoleAuthRepository.AddData(updateAuths);
+                _RoleAuthRepository.AddData(updateAuths.Where(x => x.AuthId <= 0).ToList());
 
                 //鑾峰彇鏉冮檺鍙栨秷鐨勬潈闄�
                 int[] authIds = roleAuths.Where(x => userPermissions.Select(u => u.Id)

--
Gitblit v1.9.3