😎修复更新用户时逻辑错误
This commit is contained in:
parent
2c7db8bcd3
commit
13a7c2bcbe
@ -144,15 +144,7 @@ public class SysUserService : IDynamicApiController, ITransient
|
||||
{
|
||||
var query = _sysUserRep.AsQueryable().ClearFilter().Where(u => u.Id != input.Id);
|
||||
if (await query.AnyAsync(u => u.Account == input.Account)) throw Oops.Oh(ErrorCodeEnum.D1003);
|
||||
if (!string.IsNullOrWhiteSpace(input.Phone) && await query.AnyAsync(u => u.Phone == input.Phone)) throw Oops.Oh(ErrorCodeEnum.D1032);
|
||||
|
||||
await _sysUserRep.AsUpdateable(input.Adapt<SysUser>()).IgnoreColumns(true).IgnoreColumns(u => new { u.Password, u.Status, u.TenantId }).ExecuteCommandAsync();
|
||||
|
||||
// 更新用户附属机构
|
||||
await UpdateRoleAndExtOrg(input);
|
||||
|
||||
// 删除用户机构缓存
|
||||
SqlSugarFilter.DeleteUserOrgCache(input.Id, _sysUserRep.Context.CurrentConnectionConfig.ConfigId.ToString());
|
||||
if (!string.IsNullOrWhiteSpace(input.Phone) && await query.AnyAsync(u => u.Phone == input.Phone)) throw Oops.Oh(ErrorCodeEnum.D1032);
|
||||
|
||||
// 若账号的角色和组织架构发生变化,则强制下线账号进行权限更新
|
||||
var user = await _sysUserRep.GetByIdAsync(input.Id);
|
||||
@ -161,7 +153,16 @@ public class SysUserService : IDynamicApiController, ITransient
|
||||
{
|
||||
// 强制下线账号和失效Token
|
||||
await OfflineAndExpireToken(user);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新用户
|
||||
await _sysUserRep.AsUpdateable(input.Adapt<SysUser>()).IgnoreColumns(true).IgnoreColumns(u => new { u.Password, u.Status, u.TenantId }).ExecuteCommandAsync();
|
||||
|
||||
// 更新用户附属机构
|
||||
await UpdateRoleAndExtOrg(input);
|
||||
|
||||
// 删除用户机构缓存
|
||||
SqlSugarFilter.DeleteUserOrgCache(input.Id, _sysUserRep.Context.CurrentConnectionConfig.ConfigId.ToString());
|
||||
|
||||
// 更新域账号
|
||||
await _sysUserLdapService.AddUserLdap(user.TenantId!.Value, user.Id, user.Account, input.DomainAccount);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user