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)))