From dfe2d4cc37844fcf0e401b8a8f68bdeb9d6f67c3 Mon Sep 17 00:00:00 2001 From: ccnetcore Date: Sat, 21 Jun 2025 13:29:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=8C=E8=B6=85=E7=AE=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/System/UserService.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs index 70597f3b..3a386b97 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs @@ -145,11 +145,15 @@ namespace Yi.Framework.Rbac.Application.Services.System /// [OperLog("更新用户", OperEnum.Update)] [Permission("system:user:edit")] - public async override Task UpdateAsync(Guid id, UserUpdateInputVo input) + public override async Task UpdateAsync(Guid id, UserUpdateInputVo input) { - if (input.UserName == UserConst.Admin || input.UserName == UserConst.TenantAdmin) + //不是超管,不能更新成超管 + if (!UserConst.Admin.Equals(CurrentUser.UserName)) { - throw new UserFriendlyException(UserConst.Name_Not_Allowed); + if (input.UserName == UserConst.Admin || input.UserName == UserConst.TenantAdmin) + { + throw new UserFriendlyException(UserConst.Name_Not_Allowed); + } } if (await _repository.IsAnyAsync(u => input.UserName!.Equals(u.UserName) && !id.Equals(u.Id)))