/// <summary> /// 分配用户角色 /// </summary> public async Task AssignRoles(AssignRolesInput input, int tenantId) { using (CurrentUnitOfWork.SetTenantId(tenantId)) { await _userAppService.AssignRoles(input); } }
/// <summary> /// 分配用户角色 /// </summary> public async Task AssignRoles(AssignRolesInput input) { var user = await UserManager.GetUserByIdAsync(input.UserId); if (user == null) { throw new UserFriendlyException($"用户ID:[{input.UserId}]不存在!"); } CheckErrors(await UserManager.SetRoles(user, input.AssignedRoleNames)); }