Browse Source

Merge pull request #810 from colinin/rel-7.1.0

Upgrade abp framework to 7.1.0
pull/819/head
yx lin 3 years ago
committed by GitHub
parent
commit
7566131fc2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .github/workflows/release.yml
  2. 15
      apps/vue/src/api/sys/user.ts
  3. 6
      apps/vue/src/api/text-templating/definitions/index.ts
  4. 4
      apps/vue/src/api/text-templating/definitions/model/index.ts
  5. 6
      apps/vue/src/locales/lang/en/sys.ts
  6. 3
      apps/vue/src/locales/lang/zh-CN/sys.ts
  7. 20
      apps/vue/src/utils/http/axios/checkStatus.ts
  8. 99
      apps/vue/src/views/text-templating/templates/components/TemplateDefinitionModal.vue
  9. 33
      apps/vue/src/views/text-templating/templates/components/TemplateDefinitionTable.vue
  10. 145
      apps/vue/src/views/text-templating/templates/datas/ModalData.ts
  11. 6
      aspnet-core/Directory.Build.props
  12. 39
      aspnet-core/LINGYUN.MicroService.WebhooksManagement.sln
  13. 20
      aspnet-core/LINGYUN.MicroService.Workflow.sln
  14. 2
      aspnet-core/common.props
  15. 2
      aspnet-core/migrations/LY.MicroService.AuthServer.EntityFrameworkCore/AuthServerMigrationsEntityFrameworkCoreModule.cs
  16. 1118
      aspnet-core/migrations/LY.MicroService.AuthServer.EntityFrameworkCore/Migrations/20230323062929_Upgrade-Abp-Framework-To-7.1.0.Designer.cs
  17. 51
      aspnet-core/migrations/LY.MicroService.AuthServer.EntityFrameworkCore/Migrations/20230323062929_Upgrade-Abp-Framework-To-7.1.0.cs
  18. 11
      aspnet-core/migrations/LY.MicroService.AuthServer.EntityFrameworkCore/Migrations/AuthServerMigrationsDbContextModelSnapshot.cs
  19. 587
      aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/20230323070528_Upgrade-Abp-Framework-To-7.1.0.Designer.cs
  20. 40
      aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/20230323070528_Upgrade-Abp-Framework-To-7.1.0.cs
  21. 6
      aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/BackendAdminMigrationsDbContextModelSnapshot.cs
  22. 1786
      aspnet-core/migrations/LY.MicroService.IdentityServer.EntityFrameworkCore/Migrations/20230323065507_Upgrade-Abp-Framework-To-7.1.0.Designer.cs
  23. 51
      aspnet-core/migrations/LY.MicroService.IdentityServer.EntityFrameworkCore/Migrations/20230323065507_Upgrade-Abp-Framework-To-7.1.0.cs
  24. 11
      aspnet-core/migrations/LY.MicroService.IdentityServer.EntityFrameworkCore/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs
  25. 261
      aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20230324095512_Add-Description-To-Subscription.Designer.cs
  26. 42
      aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20230324095512_Add-Description-To-Subscription.cs
  27. 11
      aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs
  28. 12
      aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging/LINGYUN/Abp/AuditLogging/AbpAuditLoggingModule.cs
  29. 1
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN.Abp.Elsa.Server.csproj
  30. 29
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaAutoMapperProfile.cs
  31. 14
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerModule.cs
  32. 6
      aspnet-core/modules/localization/LINGYUN.Abp.AspNetCore.Mvc.Localization/LINGYUN/Abp/AspNetCore/Mvc/Localization/TextAppService.cs
  33. 9
      aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain.Shared/LINGYUN/Abp/LocalizationManagement/LanguageEto.cs
  34. 10
      aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain.Shared/LINGYUN/Abp/LocalizationManagement/ResourceEto.cs
  35. 8
      aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/ILocalizationStoreCache.cs
  36. 124
      aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationCacheInvalidator.cs
  37. 2
      aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationManagementDomainMapperProfile.cs
  38. 22
      aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationStoreInMemoryCache.cs
  39. 5
      aspnet-core/modules/mvc/LINGYUN.Abp.AspNetCore.Mvc.Wrapper/LINGYUN/Abp/AspNetCore/Mvc/HttpResponseWrapper.cs
  40. 5
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.LinkUser/LINGYUN/Abp/OpenIddict/LinkUser/AbpOpenIddictLinkUserModule.cs
  41. 109
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.LinkUser/LINGYUN/Abp/OpenIddict/LinkUser/LinkUserTokenExtensionGrant.cs
  42. 2
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Sms/LINGYUN/Abp/OpenIddict/Sms/AbpOpenIddictSmsModule.cs
  43. 119
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Sms/LINGYUN/Abp/OpenIddict/Sms/SmsTokenExtensionGrant.cs
  44. 5
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/AbpOpenIddictWeChatModule.cs
  45. 33
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/Controllers/TokenController.WeChat.MiniProgram.cs
  46. 32
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/Controllers/TokenController.WeChat.Official.cs
  47. 41
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/WeChatMiniProgramTokenExtensionGrant.cs
  48. 41
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/WeChatOffcialTokenExtensionGrant.cs
  49. 147
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/WeChatTokenExtensionGrant.cs
  50. 1
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN.Abp.Saas.Domain.Shared.csproj
  51. 5
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/AbpSaasDomainSharedModule.cs
  52. 5
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Editions/EditionEto.cs
  53. 5
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantEto.cs
  54. 5
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Editions/Edition.cs
  55. 6
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Tenants/Tenant.cs
  56. 27
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobTypeSelector.cs
  57. 10
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundJobManager.cs
  58. 10
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerManager.cs
  59. 2
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionDto.cs
  60. 2
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionGetListInput.cs
  61. 4
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs
  62. 37
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionAppService.cs
  63. 1
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/en.json
  64. 1
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/zh-Hans.json
  65. 16
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionEto.cs
  66. 13
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateEto.cs
  67. 7
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj
  68. 16
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs
  69. 78
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TemplateDefinitionStoreCacheInvalidator.cs
  70. 6
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateCacheItemInvalidator.cs
  71. 6
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentCacheItem.cs
  72. 10
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentContributor.cs
  73. 11
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateMapperProfile.cs
  74. 2
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/IDynamicWebhookDefinitionStore.cs
  75. 2
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/IStaticWebhookDefinitionStore.cs
  76. 15
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/IWebhookDefinitionManager.cs
  77. 7
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/NullDynamicWebhookDefinitionStore.cs
  78. 9
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/StaticWebhookDefinitionStore.cs
  79. 5
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/WebhookDefinition.cs
  80. 19
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/WebhookDefinitionManager.cs
  81. 7
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/WebhookGroupDefinition.cs
  82. 30
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs
  83. 34
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissionDefinitionProvider.cs
  84. 16
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissions.cs
  85. 16
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionCreateDto.cs
  86. 22
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionCreateOrUpdateDto.cs
  87. 26
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionDto.cs
  88. 8
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionGetListInput.cs
  89. 10
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionUpdateDto.cs
  90. 10
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionCreateDto.cs
  91. 13
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionCreateOrUpdateDto.cs
  92. 16
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionDto.cs
  93. 8
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionGetListInput.cs
  94. 10
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionUpdateDto.cs
  95. 19
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/IWebhookDefinitionAppService.cs
  96. 18
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/IWebhookGroupDefinitionAppService.cs
  97. 4
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSendRecordAppService.cs
  98. 2
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSubscriptionAppService.cs
  99. 8
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordDeleteManyInput.cs
  100. 8
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordResendManyInput.cs

4
.github/workflows/release.yml

@ -2,7 +2,7 @@ name: "Tagged Release"
on:
push:
branches: [ rel-7.0.3 ]
branches: [ rel-7.1.0 ]
jobs:
tagged-release:
@ -14,4 +14,4 @@ jobs:
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
automatic_release_tag: "7.0.3"
automatic_release_tag: "7.1.0"

15
apps/vue/src/api/sys/user.ts

@ -9,6 +9,11 @@ import { useGlobSetting } from '/@/hooks/setting';
import { ContentTypeEnum } from '/@/enums/httpEnum';
import { ErrorMessageMode } from '/#/axios';
import { t } from '/@/hooks/web/useI18n';
import { useMessage } from '/@/hooks/web/useMessage';
import { useUserStoreWithOut } from '/@/store/modules/user';
const { createErrorModal } = useMessage();
enum Api {
Login = '/connect/token',
@ -87,6 +92,16 @@ export function getUserInfo() {
{
errorMessageMode: 'none',
apiUrl: '/connect',
}).catch(() => {
const userStore = useUserStoreWithOut();
createErrorModal({
title: t('sys.api.errorTip'),
content: t('sys.api.getUserInfoErrorMessage'),
onOk: () => {
userStore.setToken(undefined);
userStore.logout(true);
}
});
});
}

6
apps/vue/src/api/text-templating/definitions/index.ts

@ -15,7 +15,7 @@ export const CreateAsyncByInput = (input: TextTemplateDefinitionCreateDto) => {
controller: controllerName,
action: 'CreateAsync',
uniqueName: 'CreateAsyncByInput',
params: input,
data: input,
});
};
@ -49,7 +49,9 @@ export const GetListAsyncByInput = (input: TextTemplateDefinitionGetListInput) =
controller: controllerName,
action: 'GetListAsync',
uniqueName: 'GetListAsyncByInput',
params: input,
params: {
input: input,
},
});
};

4
apps/vue/src/api/text-templating/definitions/model/index.ts

@ -1,10 +1,12 @@
export interface TextTemplateDefinitionDto {
name: string;
displayName: string;
formatedDisplayName?: string;
defaultCultureName?: string;
isInlineLocalized: boolean;
isLayout: boolean;
layout: string;
layout?: string;
layoutName?: string;
isStatic: boolean;
renderEngine?: string;
}

6
apps/vue/src/locales/lang/en/sys.ts

@ -7,10 +7,10 @@ export default {
apiTimeoutMessage: 'The interface request timed out, please refresh the page and try again!',
apiRequestFailed: 'The interface request failed, please try again later!',
networkException: 'network anomaly',
networkExceptionMsg:
'Please check if your network connection is normal! The network is abnormal',
networkExceptionMsg: 'Please check if your network connection is normal! The network is abnormal',
getUserInfoErrorMessage: 'Failed to obtain user information. Please log in again!',
errMsg401: 'The user does not have permission (token, user name, password error)!',
errMsg401: 'The request interface requires authentication. You failed authentication or the session timed out. Please log in again!',
errMsg403: 'The user is authorized, but access is forbidden!',
errMsg404: 'Network request error, the resource was not found!',
errMsg405: 'Network request error, request method not allowed!',

3
apps/vue/src/locales/lang/zh-CN/sys.ts

@ -8,8 +8,9 @@ export default {
apiRequestFailed: '请求出错,请稍候重试',
networkException: '网络异常',
networkExceptionMsg: '网络异常,请检查您的网络连接是否正常!',
getUserInfoErrorMessage: '获取用户信息失败, 请重新登录!',
errMsg401: '用户没有权限(令牌、用户名、密码错误)!',
errMsg401: '请求接口需要验证身份,您未通过认证或会话已超时, 请重新登录!',
errMsg403: '用户得到授权,但是访问是被禁止的。!',
errMsg404: '网络请求错误,未找到该资源!',
errMsg405: '网络请求错误,请求方法未允许!',

20
apps/vue/src/utils/http/axios/checkStatus.ts

@ -68,6 +68,8 @@ export function checkStatus(
errMessage = t('sys.api.errMsg505');
break;
default:
errMessage = t('sys.api.apiRequestFailed');
break;
}
if (errMessage) {
@ -80,16 +82,6 @@ export function checkStatus(
}
export function checkResponse(response: any): string | undefined {
if (!response?.data) {
// 都没捕获到则提示默认错误信息
const { t } = useI18n();
const message = t('sys.api.apiRequestFailed');
checkStatus(response.status, message);
return message;
}
let errorJson = response.data.error;
// 会话超时
if (response.status === 401) {
const userStore = useUserStoreWithOut();
@ -98,6 +90,14 @@ export function checkResponse(response: any): string | undefined {
const { t } = useI18n();
return t('sys.api.errMsg401');
}
if (!response?.data) {
// 都没捕获到则提示默认错误信息
checkStatus(response, '');
return undefined;
}
let errorJson = response.data.error;
// abp框架抛出异常信息
if (response.headers['_abperrorformat'] === 'true') {

99
apps/vue/src/views/text-templating/templates/components/TemplateDefinitionModal.vue

@ -0,0 +1,99 @@
<template>
<BasicModal
@register="registerModal"
:title="L('TextTemplates')"
:width="800"
:min-height="400"
@ok="handleSubmit"
>
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { reactive, nextTick } from 'vue';
import { BasicForm, useForm } from '/@/components/Form';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useLocalization } from '/@/hooks/abp/useLocalization';
import { GetByNameAsyncByName, CreateAsyncByInput, UpdateAsyncByNameAndInput } from '/@/api/text-templating/definitions';
import { getModalFormSchemas } from '../datas/ModalData';
const emits = defineEmits(['register', 'change']);
const state = reactive({
isEdit: false
});
const { createMessage } = useMessage();
const { L } = useLocalization(['AbpTextTemplating']);
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
labelWidth: 150,
showActionButtonGroup: false,
schemas: getModalFormSchemas(),
});
const [registerModal, { changeLoading, changeOkLoading, closeModal }] = useModalInner((data) => {
nextTick(() => {
fetch(data?.name);
});
});
function fetch(name?: string) {
state.isEdit = false;
resetFields();
if (!name) {
updateSchema({
field: 'name',
dynamicDisabled: state.isEdit,
});
return;
}
changeLoading(true);
changeOkLoading(true);
GetByNameAsyncByName(name).then((res) => {
state.isEdit = true;
updateSchema({
field: 'name',
dynamicDisabled: state.isEdit,
});
setFieldsValue(res);
if (res.formatedDisplayName) {
// L:XXX,YYY
const splitChars = res.formatedDisplayName.split(',');
if (splitChars.length >= 2 && splitChars[0].startsWith('L:')) {
const resource = splitChars[0].substring(2);
setFieldsValue({
resource: resource,
text: splitChars[1],
});
}
}
}).finally(() => {
changeLoading(false);
changeOkLoading(false);
});
}
function handleSubmit() {
validate().then((input) => {
input.displayName = `L:${input.resource},${input.text}`;
changeLoading(true);
changeOkLoading(true);
const submitApi = state.isEdit
? UpdateAsyncByNameAndInput(input.name, input)
: CreateAsyncByInput(input);
submitApi.then((res) => {
setFieldsValue(res);
createMessage.success(L('Successful'));
emits('change', res);
closeModal();
}).finally(() => {
changeLoading(false);
changeOkLoading(false);
});
});
}
</script>
<style lang="less" scoped>
</style>

33
apps/vue/src/views/text-templating/templates/components/TemplateDefinitionTable.vue

@ -1,6 +1,14 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<Button
v-auth="['AbpTextTemplating.TextTemplateDefinitions.Create']"
type="primary"
@click="handleAddNew"
>{{ L('TextTemplates:AddNew') }}
</Button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'isStatic'">
<CheckOutlined v-if="record.isStatic" class="enable" />
@ -16,12 +24,15 @@
</template>
<template v-else-if="column.key === 'action'">
<TableAction
v-auth="['AbpTextTemplating.TextTemplateDefinitions', 'AbpTextTemplating.TextTemplateDefinitions.Delete']"
v-auth="[
'AbpTextTemplating.TextTemplateDefinitions.Update',
'AbpTextTemplating.TextTemplateDefinitions.Delete',
'AbpTextTemplating.TextTemplateContents.Update']"
:stop-button-propagation="true"
:actions="[
{
auth: 'AbpTextTemplating.TextTemplateDefinitions.Update',
label: L('Update'),
label: L('Edit'),
icon: 'ant-design:edit-outlined',
onClick: handleEdit.bind(null, record),
},
@ -35,7 +46,7 @@
]"
:dropDownActions="[
{
auth: 'AbpTextTemplating.TextTemplateContent.Update',
auth: 'AbpTextTemplating.TextTemplateContents.Update',
label: L('EditContents'),
icon: 'ant-design:edit-outlined',
onClick: handleEditContent.bind(null, record),
@ -45,11 +56,13 @@
</template>
</template>
</BasicTable>
<TemplateContentModal @register="registerModal" />
<TemplateContentModal @register="registerContentModal" />
<TemplateDefinitionModal @register="registerEditModal" @change="reload" />
</div>
</template>
<script lang="ts" setup>
import { Button } from 'ant-design-vue';
import { CheckOutlined, CloseOutlined } from '@ant-design/icons-vue';
import { useModal } from '/@/components/Modal';
import { BasicTable, TableAction, useTable } from '/@/components/Table';
@ -61,10 +74,12 @@
import { TextTemplateDefinitionDto } from '/@/api/text-templating/definitions/model';
import { formatPagedRequest } from '/@/utils/http/abp/helper';
import TemplateContentModal from './TemplateContentModal.vue';
import TemplateDefinitionModal from './TemplateDefinitionModal.vue';
const { L } = useLocalization(['AbpTextTemplating', 'AbpUi']);
const { createConfirm, createMessage } = useMessage();
const [registerModal, { openModal }] = useModal();
const [registerEditModal, { openModal: openEditModal }] = useModal();
const [registerContentModal, { openModal: openContentModal }] = useModal();
const [registerTable, { reload }] = useTable({
rowKey: 'name',
title: L('TextTemplates'),
@ -87,12 +102,16 @@
},
});
function handleAddNew() {
openEditModal(true, {});
}
function handleEdit(record: TextTemplateDefinitionDto) {
console.log('This method is not implemented', record);
openEditModal(true, record);
}
function handleEditContent(record: TextTemplateDefinitionDto) {
openModal(true, record);
openContentModal(true, record);
}
function handleDelete(record: TextTemplateDefinitionDto) {

145
apps/vue/src/views/text-templating/templates/datas/ModalData.ts

@ -1,7 +1,13 @@
import { useAbpStoreWithOut } from '/@/store/modules/abp';
import { useLocalization } from '/@/hooks/abp/useLocalization';
import { FormProps, FormSchema } from '/@/components/Form';
import { getList as getResources } from '/@/api/localization/resources';
import { getList as getLanguages } from '/@/api/localization/languages';
import { getList as getTexts } from '/@/api/localization/texts';
import { GetListAsyncByInput as getTemplateDefintions } from '/@/api/text-templating/definitions';
const { L } = useLocalization(['AbpTextTemplating', 'AbpUi']);
const abpStore = useAbpStoreWithOut();
const { L } = useLocalization(['AbpTextTemplating', 'AbpLocalization', 'AbpUi']);
export function getSearchFormSchemas(): Partial<FormProps> {
return {
@ -19,6 +25,80 @@ export function getSearchFormSchemas(): Partial<FormProps> {
export function getModalFormSchemas(): FormSchema[] {
return [
{
field: 'concurrencyStamp',
component: 'Input',
label: 'concurrencyStamp',
colProps: { span: 24 },
show: false,
},
{
field: 'isInlineLocalized',
component: 'Checkbox',
label: L('DisplayName:IsInlineLocalized'),
colProps: { span: 24 },
defaultValue: false,
renderComponentContent: L('DisplayName:IsInlineLocalized'),
},
{
field: 'defaultCultureName',
component: 'ApiSelect',
label: L('DisplayName:DefaultCultureName'),
colProps: { span: 24 },
componentProps: {
api: getLanguages,
params: {
input: {
skipCount: 0,
maxResultCount: 100,
},
},
resultField: 'items',
labelField: 'displayName',
valueField: 'cultureName',
},
},
{
field: 'isLayout',
component: 'Checkbox',
label: L('DisplayName:IsLayout'),
colProps: { span: 24 },
defaultValue: false,
renderComponentContent: L('DisplayName:IsLayout'),
componentProps: ({ formActionType }) => {
return {
onChange: (e) => {
if (e.target.checked) {
formActionType.setFieldsValue({
layout: '',
});
}
}
}
},
},
{
field: 'layout',
component: 'ApiSelect',
label: L('DisplayName:Layout'),
colProps: { span: 24 },
ifShow: ({ values }) => {
return values.isLayout === false;
},
componentProps: {
api: getTemplateDefintions,
params: {
input: {
skipCount: 0,
maxResultCount: 100,
isLayout: true,
},
},
resultField: 'items',
labelField: 'displayName',
valueField: 'name',
},
},
{
field: 'name',
component: 'Input',
@ -26,5 +106,68 @@ export function getModalFormSchemas(): FormSchema[] {
colProps: { span: 24 },
required: true,
},
{
field: 'resource',
component: 'ApiSelect',
label: L('DisplayName:ResourceName'),
colProps: { span: 12 },
required: true,
componentProps: ({ formActionType }) => {
return {
api: getResources,
resultField: 'items',
labelField: 'displayName',
valueField: 'name',
showSearch: true,
filterOption: (input: string, option: any) => {
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
onChange: (val) => {
formActionType.setFieldsValue({
text: '',
});
getTexts({
cultureName: 'en',
targetCultureName: abpStore.getApplication.localization.currentCulture.cultureName,
resourceName: val,
filter: '',
onlyNull: false,
}).then((res) => {
formActionType.updateSchema({
field: 'text',
componentProps: {
options: res.items.map((item) => {
return {
label: item.targetValue,
value: item.key,
}
}),
}
});
});
},
getPopupContainer: (triggerNode) => triggerNode.parentNode,
style: {
width: '100%',
},
}
},
},
{
field: 'text',
component: 'Select',
label: L('DisplayName:DisplayName'),
colProps: { span: 12 },
required: true,
componentProps: {
showSearch: true,
filterOption: (input: string, option: any) => {
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
style: {
width: '100%',
},
},
},
];
}

6
aspnet-core/Directory.Build.props

@ -1,12 +1,12 @@
<Project>
<PropertyGroup>
<VoloAbpPackageVersion>7.0.3</VoloAbpPackageVersion>
<VoloAbpPackageVersion>7.1.0</VoloAbpPackageVersion>
<VoloAbpLeptonXThemePackageVersion>2.0.1</VoloAbpLeptonXThemePackageVersion>
<LINGYUNAbpPackageVersion>7.0.3</LINGYUNAbpPackageVersion>
<LINGYUNAbpPackageVersion>7.1.0</LINGYUNAbpPackageVersion>
<DaprPackageVersion>1.10.0</DaprPackageVersion>
<DistributedLockRedisPackageVersion>1.0.2</DistributedLockRedisPackageVersion>
<DotNetCoreCAPPackageVersion>7.1.0</DotNetCoreCAPPackageVersion>
<ElsaPackageVersion>2.10.1</ElsaPackageVersion>
<ElsaPackageVersion>2.11.0</ElsaPackageVersion>
<AliyunSDKPackageVersion>1.5.10</AliyunSDKPackageVersion>
<AliyunOSSSDKPackageVersion>2.13.0</AliyunOSSSDKPackageVersion>
<TencentCloudSDKPackageVersion>3.0.712</TencentCloudSDKPackageVersion>

39
aspnet-core/LINGYUN.MicroService.WebhooksManagement.sln

@ -51,6 +51,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks", "modules\task-management\LINGYUN.Abp.BackgroundTasks\LINGYUN.Abp.BackgroundTasks.csproj", "{B01A8350-EFA3-4080-9CD6-0E991F99578E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wrapper", "wrapper", "{4530BC52-D8D7-4022-B1E9-F327A0574835}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dapr", "dapr", "{E677C08C-DF2A-44DB-A2E2-E491734F3D5B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Dapr", "modules\dapr\LINGYUN.Abp.Dapr\LINGYUN.Abp.Dapr.csproj", "{FCA0D08C-9F5B-4933-899B-EDF72E868691}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Dapr.Client", "modules\dapr\LINGYUN.Abp.Dapr.Client\LINGYUN.Abp.Dapr.Client.csproj", "{FA12A8B4-255B-4619-B670-0F07C677C736}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Dapr.Client.Wrapper", "modules\dapr\LINGYUN.Abp.Dapr.Client.Wrapper\LINGYUN.Abp.Dapr.Client.Wrapper.csproj", "{37053701-FD7D-4204-BF82-4FEDE0A28E60}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Wrapper", "modules\common\LINGYUN.Abp.Wrapper\LINGYUN.Abp.Wrapper.csproj", "{9AEE2B36-D7A7-4EA2-8A22-888E896012E8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AspNetCore.Mvc.Wrapper", "modules\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj", "{FFE603F9-DB7E-45C8-9852-354363F9D799}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -133,6 +147,26 @@ Global
{B01A8350-EFA3-4080-9CD6-0E991F99578E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B01A8350-EFA3-4080-9CD6-0E991F99578E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B01A8350-EFA3-4080-9CD6-0E991F99578E}.Release|Any CPU.Build.0 = Release|Any CPU
{FCA0D08C-9F5B-4933-899B-EDF72E868691}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCA0D08C-9F5B-4933-899B-EDF72E868691}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCA0D08C-9F5B-4933-899B-EDF72E868691}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FCA0D08C-9F5B-4933-899B-EDF72E868691}.Release|Any CPU.Build.0 = Release|Any CPU
{FA12A8B4-255B-4619-B670-0F07C677C736}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA12A8B4-255B-4619-B670-0F07C677C736}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA12A8B4-255B-4619-B670-0F07C677C736}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA12A8B4-255B-4619-B670-0F07C677C736}.Release|Any CPU.Build.0 = Release|Any CPU
{37053701-FD7D-4204-BF82-4FEDE0A28E60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37053701-FD7D-4204-BF82-4FEDE0A28E60}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37053701-FD7D-4204-BF82-4FEDE0A28E60}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37053701-FD7D-4204-BF82-4FEDE0A28E60}.Release|Any CPU.Build.0 = Release|Any CPU
{9AEE2B36-D7A7-4EA2-8A22-888E896012E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AEE2B36-D7A7-4EA2-8A22-888E896012E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AEE2B36-D7A7-4EA2-8A22-888E896012E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AEE2B36-D7A7-4EA2-8A22-888E896012E8}.Release|Any CPU.Build.0 = Release|Any CPU
{FFE603F9-DB7E-45C8-9852-354363F9D799}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFE603F9-DB7E-45C8-9852-354363F9D799}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFE603F9-DB7E-45C8-9852-354363F9D799}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFE603F9-DB7E-45C8-9852-354363F9D799}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -157,6 +191,11 @@ Global
{CC0BF1BE-A938-4BED-B5DD-AEA0235FF978} = {2868332B-7D4F-4B43-8FC3-BA5CACC36C7E}
{8BFCE8C7-D41A-4D9C-9567-4155B7AC79FE} = {C8BF949C-3370-4727-BA20-5AB13CF9AAD6}
{B01A8350-EFA3-4080-9CD6-0E991F99578E} = {C8BF949C-3370-4727-BA20-5AB13CF9AAD6}
{FCA0D08C-9F5B-4933-899B-EDF72E868691} = {E677C08C-DF2A-44DB-A2E2-E491734F3D5B}
{FA12A8B4-255B-4619-B670-0F07C677C736} = {E677C08C-DF2A-44DB-A2E2-E491734F3D5B}
{37053701-FD7D-4204-BF82-4FEDE0A28E60} = {E677C08C-DF2A-44DB-A2E2-E491734F3D5B}
{9AEE2B36-D7A7-4EA2-8A22-888E896012E8} = {4530BC52-D8D7-4022-B1E9-F327A0574835}
{FFE603F9-DB7E-45C8-9852-354363F9D799} = {4530BC52-D8D7-4022-B1E9-F327A0574835}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {80ED12A5-C899-459F-A181-ADCC9D680DE5}

20
aspnet-core/LINGYUN.MicroService.Workflow.sln

@ -49,11 +49,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa.EntityFram
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{035B86BF-DD63-4A78-B8CE-29994860C948}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.Tests", "tests\LINGYUN.Abp.Elsa.Tests\LINGYUN.Abp.Elsa.Tests.csproj", "{9F96F261-93F7-47C0-8F07-72CE39CE20A3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa.Tests", "tests\LINGYUN.Abp.Elsa.Tests\LINGYUN.Abp.Elsa.Tests.csproj", "{9F96F261-93F7-47C0-8F07-72CE39CE20A3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TestsBase", "tests\LINGYUN.Abp.TestBase\LINGYUN.Abp.TestsBase.csproj", "{8395DA41-AF40-4B0D-B36D-FA8A56E75AED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.Activities.Webhooks.Tests", "tests\LINGYUN.Abp.Elsa.Activities.Webhooks.Tests\LINGYUN.Abp.Elsa.Activities.Webhooks.Tests.csproj", "{B3C2AFCC-EE59-4CB4-AB62-B90D60335632}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa.Activities.Webhooks.Tests", "tests\LINGYUN.Abp.Elsa.Activities.Webhooks.Tests\LINGYUN.Abp.Elsa.Activities.Webhooks.Tests.csproj", "{B3C2AFCC-EE59-4CB4-AB62-B90D60335632}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "auditing", "auditing", "{D2E33CD0-B6CA-49B7-930C-018257E78D99}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AuditLogging", "modules\auditing\LINGYUN.Abp.AuditLogging\LINGYUN.Abp.AuditLogging.csproj", "{A03A98B6-19E9-4CCA-9801-AEFCBAAF5B72}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AuditLogging.Elasticsearch", "modules\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj", "{00AB0A7E-578E-469C-B049-BCAA0233A9DD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -149,6 +155,14 @@ Global
{B3C2AFCC-EE59-4CB4-AB62-B90D60335632}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3C2AFCC-EE59-4CB4-AB62-B90D60335632}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3C2AFCC-EE59-4CB4-AB62-B90D60335632}.Release|Any CPU.Build.0 = Release|Any CPU
{A03A98B6-19E9-4CCA-9801-AEFCBAAF5B72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A03A98B6-19E9-4CCA-9801-AEFCBAAF5B72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A03A98B6-19E9-4CCA-9801-AEFCBAAF5B72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A03A98B6-19E9-4CCA-9801-AEFCBAAF5B72}.Release|Any CPU.Build.0 = Release|Any CPU
{00AB0A7E-578E-469C-B049-BCAA0233A9DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00AB0A7E-578E-469C-B049-BCAA0233A9DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00AB0A7E-578E-469C-B049-BCAA0233A9DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00AB0A7E-578E-469C-B049-BCAA0233A9DD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -176,6 +190,8 @@ Global
{9F96F261-93F7-47C0-8F07-72CE39CE20A3} = {035B86BF-DD63-4A78-B8CE-29994860C948}
{8395DA41-AF40-4B0D-B36D-FA8A56E75AED} = {035B86BF-DD63-4A78-B8CE-29994860C948}
{B3C2AFCC-EE59-4CB4-AB62-B90D60335632} = {035B86BF-DD63-4A78-B8CE-29994860C948}
{A03A98B6-19E9-4CCA-9801-AEFCBAAF5B72} = {D2E33CD0-B6CA-49B7-930C-018257E78D99}
{00AB0A7E-578E-469C-B049-BCAA0233A9DD} = {D2E33CD0-B6CA-49B7-930C-018257E78D99}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6BB7A5DE-DA12-44DC-BC9B-0F6CA524346F}

2
aspnet-core/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>7.0.3</Version>
<Version>7.1.0</Version>
<Authors>colin</Authors>
<NoWarn>$(NoWarn);CS1591;CS0436;CS8618;NU1803</NoWarn>
<PackageProjectUrl>https://github.com/colinin/abp-next-admin</PackageProjectUrl>

2
aspnet-core/migrations/LY.MicroService.AuthServer.EntityFrameworkCore/AuthServerMigrationsEntityFrameworkCoreModule.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Identity.EntityFrameworkCore;
using LINGYUN.Abp.Saas.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
@ -10,6 +11,7 @@ namespace LY.MicroService.AuthServer.EntityFrameworkCore;
[DependsOn(
typeof(AbpSaasEntityFrameworkCoreModule),
typeof(AbpOpenIddictEntityFrameworkCoreModule),
typeof(AbpIdentityEntityFrameworkCoreModule),
typeof(AbpDataDbMigratorModule)
)]
public class AuthServerMigrationsEntityFrameworkCoreModule : AbpModule

1118
aspnet-core/migrations/LY.MicroService.AuthServer.EntityFrameworkCore/Migrations/20230323062929_Upgrade-Abp-Framework-To-7.1.0.Designer.cs

File diff suppressed because it is too large

51
aspnet-core/migrations/LY.MicroService.AuthServer.EntityFrameworkCore/Migrations/20230323062929_Upgrade-Abp-Framework-To-7.1.0.cs

@ -0,0 +1,51 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LY.MicroService.AuthServer.EntityFrameworkCore.Migrations
{
/// <inheritdoc />
public partial class UpgradeAbpFrameworkTo710 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpUsers",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpRoles",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpOrganizationUnits",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpRoles");
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpOrganizationUnits");
}
}
}

11
aspnet-core/migrations/LY.MicroService.AuthServer.EntityFrameworkCore/Migrations/AuthServerMigrationsDbContextModelSnapshot.cs

@ -18,7 +18,7 @@ namespace LY.MicroService.AuthServer.DbMigrator.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "7.0.1")
.HasAnnotation("ProductVersion", "7.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
@ -106,6 +106,9 @@ namespace LY.MicroService.AuthServer.DbMigrator.Migrations
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
@ -292,6 +295,9 @@ namespace LY.MicroService.AuthServer.DbMigrator.Migrations
.HasDefaultValue(false)
.HasColumnName("EmailConfirmed");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
@ -570,6 +576,9 @@ namespace LY.MicroService.AuthServer.DbMigrator.Migrations
.HasColumnType("varchar(128)")
.HasColumnName("DisplayName");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");

587
aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/20230323070528_Upgrade-Abp-Framework-To-7.1.0.Designer.cs

@ -0,0 +1,587 @@
// <auto-generated />
using System;
using LY.MicroService.BackendAdmin.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
#nullable disable
namespace LY.MicroService.BackendAdmin.EntityFrameworkCore.Migrations
{
[DbContext(typeof(BackendAdminMigrationsDbContext))]
[Migration("20230323070528_Upgrade-Abp-Framework-To-7.1.0")]
partial class UpgradeAbpFrameworkTo710
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "7.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("LINGYUN.Abp.Saas.Editions.Edition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.HasKey("Id");
b.HasIndex("DisplayName");
b.ToTable("AbpEditions", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<DateTime?>("DisableTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("EditionId")
.HasColumnType("char(36)");
b.Property<DateTime?>("EnableTime")
.HasColumnType("datetime(6)");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.HasKey("Id");
b.HasIndex("EditionId");
b.HasIndex("Name");
b.ToTable("AbpTenants", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.TenantConnectionString", b =>
{
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("varchar(1024)");
b.HasKey("TenantId", "Name");
b.ToTable("AbpTenantConnectionStrings", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.TextTemplating.TextTemplate", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Content")
.HasMaxLength(1048576)
.HasColumnType("longtext")
.HasColumnName("Content");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("Culture")
.HasMaxLength(30)
.HasColumnType("varchar(30)")
.HasColumnName("Culture");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("DisplayName");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("Name");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.HasDatabaseName("IX_Tenant_Text_Template_Name");
b.ToTable("AbpTextTemplates", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.TextTemplating.TextTemplateDefinition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("DefaultCultureName")
.HasMaxLength(30)
.HasColumnType("varchar(30)")
.HasColumnName("DefaultCultureName");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("varchar(512)")
.HasColumnName("DisplayName");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsInlineLocalized")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsLayout")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsStatic")
.HasColumnType("tinyint(1)");
b.Property<string>("Layout")
.HasMaxLength(60)
.HasColumnType("varchar(60)")
.HasColumnName("Layout");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasColumnName("Name");
b.Property<string>("RenderEngine")
.HasMaxLength(30)
.HasColumnType("varchar(30)")
.HasColumnName("RenderEngine");
b.HasKey("Id");
b.ToTable("AbpTextTemplateDefinitions", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("AllowedProviders")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("DefaultValue")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("Description")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<bool>("IsAvailableToHost")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsVisibleToClients")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ParentName")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ValueType")
.HasMaxLength(2048)
.HasColumnType("varchar(2048)");
b.HasKey("Id");
b.HasIndex("GroupName");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpFeatures", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpFeatureGroups", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("ProviderName")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey")
.IsUnique();
b.ToTable("AbpFeatureValues", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property<byte>("MultiTenancySide")
.HasColumnType("tinyint unsigned");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ParentName")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Providers")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("StateCheckers")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("GroupName");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpPermissions", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("ProviderName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey")
.IsUnique();
b.ToTable("AbpPermissionGrants", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpPermissionGroups", (string)null);
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("ProviderName")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("varchar(2048)");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey")
.IsUnique();
b.ToTable("AbpSettings", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b =>
{
b.HasOne("LINGYUN.Abp.Saas.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId");
b.Navigation("Edition");
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.TenantConnectionString", b =>
{
b.HasOne("LINGYUN.Abp.Saas.Tenants.Tenant", null)
.WithMany("ConnectionStrings")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b =>
{
b.Navigation("ConnectionStrings");
});
#pragma warning restore 612, 618
}
}
}

40
aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/20230323070528_Upgrade-Abp-Framework-To-7.1.0.cs

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LY.MicroService.BackendAdmin.EntityFrameworkCore.Migrations
{
/// <inheritdoc />
public partial class UpgradeAbpFrameworkTo710 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpTenants",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpEditions",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpEditions");
}
}
}

6
aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/BackendAdminMigrationsDbContextModelSnapshot.cs

@ -54,6 +54,9 @@ namespace LY.MicroService.BackendAdmin.EntityFrameworkCore.Migrations
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
@ -116,6 +119,9 @@ namespace LY.MicroService.BackendAdmin.EntityFrameworkCore.Migrations
b.Property<DateTime?>("EnableTime")
.HasColumnType("datetime(6)");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");

1786
aspnet-core/migrations/LY.MicroService.IdentityServer.EntityFrameworkCore/Migrations/20230323065507_Upgrade-Abp-Framework-To-7.1.0.Designer.cs

File diff suppressed because it is too large

51
aspnet-core/migrations/LY.MicroService.IdentityServer.EntityFrameworkCore/Migrations/20230323065507_Upgrade-Abp-Framework-To-7.1.0.cs

@ -0,0 +1,51 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LY.MicroService.IdentityServer.EntityFrameworkCore.Migrations
{
/// <inheritdoc />
public partial class UpgradeAbpFrameworkTo710 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpUsers",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpRoles",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpOrganizationUnits",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpRoles");
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpOrganizationUnits");
}
}
}

11
aspnet-core/migrations/LY.MicroService.IdentityServer.EntityFrameworkCore/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs

@ -18,7 +18,7 @@ namespace LY.MicroService.IdentityServer.EntityFrameworkCore.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "7.0.1")
.HasAnnotation("ProductVersion", "7.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
@ -106,6 +106,9 @@ namespace LY.MicroService.IdentityServer.EntityFrameworkCore.Migrations
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
@ -292,6 +295,9 @@ namespace LY.MicroService.IdentityServer.EntityFrameworkCore.Migrations
.HasDefaultValue(false)
.HasColumnName("EmailConfirmed");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
@ -570,6 +576,9 @@ namespace LY.MicroService.IdentityServer.EntityFrameworkCore.Migrations
.HasColumnType("varchar(128)")
.HasColumnName("DisplayName");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");

261
aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20230324095512_Add-Description-To-Subscription.Designer.cs

@ -0,0 +1,261 @@
// <auto-generated />
using System;
using LY.MicroService.WebhooksManagement.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
#nullable disable
namespace LY.MicroService.WebhooksManagement.EntityFrameworkCore.Migrations
{
[DbContext(typeof(WebhooksManagementMigrationsDbContext))]
[Migration("20230324095512_Add-Description-To-Subscription")]
partial class AddDescriptionToSubscription
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "7.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Description")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("RequiredFeatures")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("GroupName");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpWebhooksWebhooks", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookEventRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<string>("Data")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("Data");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)");
b.Property<string>("WebhookName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("WebhookName");
b.HasKey("Id");
b.ToTable("AbpWebhooksEvents", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookGroupDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpWebhooksWebhookGroups", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<string>("RequestHeaders")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("RequestHeaders");
b.Property<string>("Response")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("Response");
b.Property<string>("ResponseHeaders")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("ResponseHeaders");
b.Property<int?>("ResponseStatusCode")
.HasColumnType("int");
b.Property<bool>("SendExactSameData")
.HasColumnType("tinyint(1)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)");
b.Property<Guid>("WebhookEventId")
.HasColumnType("char(36)");
b.Property<Guid>("WebhookSubscriptionId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("WebhookEventId");
b.ToTable("AbpWebhooksSendAttempts", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSubscription", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("Description")
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasColumnName("Description");
b.Property<string>("Headers")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("Headers");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Secret")
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasColumnName("Secret");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)");
b.Property<string>("WebhookUri")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)")
.HasColumnName("WebhookUri");
b.Property<string>("Webhooks")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("Webhooks");
b.HasKey("Id");
b.ToTable("AbpWebhooksSubscriptions", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", b =>
{
b.HasOne("LINGYUN.Abp.WebhooksManagement.WebhookEventRecord", "WebhookEvent")
.WithOne()
.HasForeignKey("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", "WebhookEventId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("WebhookEvent");
});
#pragma warning restore 612, 618
}
}
}

42
aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20230324095512_Add-Description-To-Subscription.cs

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LY.MicroService.WebhooksManagement.EntityFrameworkCore.Migrations
{
/// <inheritdoc />
public partial class AddDescriptionToSubscription : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ConcurrencyStamp",
table: "AbpWebhooksSubscriptions",
type: "varchar(40)",
maxLength: 40,
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Description",
table: "AbpWebhooksSubscriptions",
type: "varchar(128)",
maxLength: 128,
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ConcurrencyStamp",
table: "AbpWebhooksSubscriptions");
migrationBuilder.DropColumn(
name: "Description",
table: "AbpWebhooksSubscriptions");
}
}
}

11
aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs

@ -191,6 +191,12 @@ namespace LY.MicroService.WebhooksManagement.EntityFrameworkCore.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
@ -199,6 +205,11 @@ namespace LY.MicroService.WebhooksManagement.EntityFrameworkCore.Migrations
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("Description")
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasColumnName("Description");
b.Property<string>("Headers")
.HasMaxLength(2147483647)
.HasColumnType("longtext")

12
aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging/LINGYUN/Abp/AuditLogging/AbpAuditLoggingModule.cs

@ -1,4 +1,6 @@
using Volo.Abp.Auditing;
using System.Collections.Generic;
using System.Threading;
using Volo.Abp.Auditing;
using Volo.Abp.ExceptionHandling;
using Volo.Abp.Guids;
using Volo.Abp.Modularity;
@ -11,5 +13,13 @@ namespace LINGYUN.Abp.AuditLogging
typeof(AbpExceptionHandlingModule))]
public class AbpAuditLoggingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpAuditingOptions>(options =>
{
options.IgnoredTypes.AddIfNotContains(typeof(CancellationToken));
options.IgnoredTypes.AddIfNotContains(typeof(CancellationTokenSource));
});
}
}
}

1
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN.Abp.Elsa.Server.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Elsa.Server.Api" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>

29
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaAutoMapperProfile.cs

@ -0,0 +1,29 @@
using AutoMapper;
using Elsa.Models;
using Elsa.Server.Api.Endpoints.WorkflowDefinitions;
using Elsa.Server.Api.Endpoints.WorkflowInstances;
using Elsa.Server.Api.Endpoints.WorkflowRegistry;
using Elsa.Server.Api.Mapping;
using Elsa.Services.Models;
using Volo.Abp.AutoMapper;
namespace LINGYUN.Abp.Elsa;
public class AbpElsaAutoMapperProfile : Profile
{
public AbpElsaAutoMapperProfile()
{
CreateMap<IWorkflowBlueprint, WorkflowBlueprintModel>()
.ForMember(x => x.IsEnabled, y => y.MapFrom(map => !map.IsDisabled))
.Ignore(x => x.InputProperties)
.Ignore(x => x.OutputProperties);
CreateMap<IWorkflowBlueprint, WorkflowBlueprintSummaryModel>();
CreateMap<IActivityBlueprint, ActivityBlueprintModel>().ConvertUsing<ActivityBlueprintConverter>();
CreateMap<ICompositeActivityBlueprint, CompositeActivityBlueprintModel>()
.Ignore(x => x.InputProperties)
.Ignore(x => x.OutputProperties);
CreateMap<IConnection, ConnectionModel>().ConvertUsing<ConnectionConverter>();
CreateMap<WorkflowInstance, WorkflowInstanceSummaryModel>();
CreateMap<WorkflowDefinition, WorkflowDefinitionSummaryModel>();
CreateMap<WorkflowDefinition, WorkflowDefinitionVersionModel>();
}
}

14
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerModule.cs

@ -5,12 +5,14 @@ using Elsa.Server.Api.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Elsa;
[DependsOn(
typeof(AbpElsaModule),
typeof(AbpAutoMapperModule),
typeof(AbpAspNetCoreMvcModule))]
public class AbpElsaServerModule : AbpModule
{
@ -21,7 +23,7 @@ public class AbpElsaServerModule : AbpModule
.AddSingleton<ActivityBlueprintConverter>()
.AddScoped<IWorkflowBlueprintMapper, WorkflowBlueprintMapper>()
.AddSingleton<IEndpointContentSerializerSettingsProvider, EndpointContentSerializerSettingsProvider>()
.AddAutoMapperProfile<AutoMapperProfile>()
.AddAutoMapperProfile<AbpElsaAutoMapperProfile>()
.AddSignalR();
PreConfigure<IMvcBuilder>(mvcBuilder =>
@ -45,4 +47,14 @@ public class AbpElsaServerModule : AbpModule
});
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<ElsaApiOptions>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpElsaAutoMapperProfile>(validate: true);
});
}
}

6
aspnet-core/modules/localization/LINGYUN.Abp.AspNetCore.Mvc.Localization/LINGYUN/Abp/AspNetCore/Mvc/Localization/TextAppService.cs

@ -31,7 +31,7 @@ namespace LINGYUN.Abp.AspNetCore.Mvc.Localization
IEnumerable<LocalizedString> localizedStrings = new List<LocalizedString>();
var localizer = await _localizerFactory.CreateByResourceNameAsync(resource.ResourceName);
using (CultureHelper.Use(input.CultureName))
using (CultureHelper.Use(input.CultureName, input.CultureName))
{
localizedStrings = localizer.GetAllStrings(true)
.OrderBy(l => l.Name);
@ -94,7 +94,7 @@ namespace LINGYUN.Abp.AspNetCore.Mvc.Localization
IEnumerable<LocalizedString> targetLocalizedStrings = new List<LocalizedString>();
var localizer = await _localizerFactory.CreateByResourceNameAsync(resource.ResourceName);
using (CultureHelper.Use(cultureName))
using (CultureHelper.Use(cultureName, cultureName))
{
localizedStrings = localizer.GetAllStrings(true)
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter))
@ -107,7 +107,7 @@ namespace LINGYUN.Abp.AspNetCore.Mvc.Localization
}
else
{
using (CultureHelper.Use(targetCultureName))
using (CultureHelper.Use(targetCultureName, targetCultureName))
{
targetLocalizedStrings = localizer.GetAllStrings(true)
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter))

9
aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain.Shared/LINGYUN/Abp/LocalizationManagement/LanguageEto.cs

@ -0,0 +1,9 @@
namespace LINGYUN.Abp.LocalizationManagement;
public class LanguageEto
{
public bool Enable { get; set; }
public string CultureName { get; set; }
public string UiCultureName { get; set; }
public string DisplayName { get; set; }
public string FlagIcon { get; set; }
}

10
aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain.Shared/LINGYUN/Abp/LocalizationManagement/ResourceEto.cs

@ -0,0 +1,10 @@
namespace LINGYUN.Abp.LocalizationManagement;
public class ResourceEto
{
public bool Enable { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public string DefaultCultureName { get; set; }
}

8
aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/ILocalizationStoreCache.cs

@ -1,5 +1,7 @@
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Localization;
@ -7,6 +9,12 @@ namespace LINGYUN.Abp.LocalizationManagement;
public interface ILocalizationStoreCache
{
string CacheStamp { get; set; }
SemaphoreSlim SyncSemaphore { get; }
DateTime? LastCheckTime { get; set; }
Task InitializeAsync(LocalizationStoreCacheInitializeContext context);
LocalizationResourceBase GetResourceOrNull(string resourceName);

124
aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationCacheInvalidator.cs

@ -0,0 +1,124 @@
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Options;
using System;
using System.Threading.Tasks;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Threading;
using Volo.Abp.Timing;
namespace LINGYUN.Abp.LocalizationManagement;
public class LocalizationCacheInvalidator :
ILocalEventHandler<EntityChangedEventData<Language>>,
ILocalEventHandler<EntityChangedEventData<Resource>>,
ILocalEventHandler<EntityChangedEventData<Text>>,
IDistributedEventHandler<EntityCreatedEto<TextEto>>,
IDistributedEventHandler<EntityUpdatedEto<TextEto>>,
IDistributedEventHandler<EntityDeletedEto<TextEto>>,
IDistributedEventHandler<EntityCreatedEto<ResourceEto>>,
IDistributedEventHandler<EntityUpdatedEto<ResourceEto>>,
IDistributedEventHandler<EntityDeletedEto<ResourceEto>>,
IDistributedEventHandler<EntityCreatedEto<LanguageEto>>,
IDistributedEventHandler<EntityUpdatedEto<LanguageEto>>,
IDistributedEventHandler<EntityDeletedEto<LanguageEto>>,
ITransientDependency
{
private readonly IClock _clock;
private readonly IDistributedCache _distributedCache;
private readonly ILocalizationStoreCache _storeCache;
private readonly AbpDistributedCacheOptions _distributedCacheOptions;
public LocalizationCacheInvalidator(
IClock clock,
ILocalizationStoreCache storeCache,
IDistributedCache distributedCache,
IOptions<AbpDistributedCacheOptions> options)
{
_clock = clock;
_storeCache = storeCache;
_distributedCache = distributedCache;
_distributedCacheOptions = options.Value;
}
public async virtual Task HandleEventAsync(EntityChangedEventData<Language> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityChangedEventData<Resource> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityChangedEventData<Text> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityCreatedEto<TextEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityUpdatedEto<TextEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityDeletedEto<TextEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityCreatedEto<ResourceEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityDeletedEto<ResourceEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityCreatedEto<LanguageEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityUpdatedEto<LanguageEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityDeletedEto<LanguageEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityUpdatedEto<ResourceEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
protected async virtual Task RemoveStampInDistributedCacheAsync()
{
using (await _storeCache.SyncSemaphore.LockAsync())
{
var cacheKey = $"{_distributedCacheOptions.KeyPrefix}_AbpInMemoryLocalizationCacheStamp";
await _distributedCache.RemoveAsync(cacheKey);
_storeCache.CacheStamp = Guid.NewGuid().ToString();
_storeCache.LastCheckTime = _clock.Now.AddMinutes(-5);
}
}
}

2
aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationManagementDomainMapperProfile.cs

@ -7,6 +7,8 @@ namespace LINGYUN.Abp.LocalizationManagement
public LocalizationManagementDomainMapperProfile()
{
CreateMap<Text, TextEto>();
CreateMap<Resource, ResourceEto>();
CreateMap<Language, LanguageEto>();
}
}
}

22
aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationStoreInMemoryCache.cs

@ -24,9 +24,10 @@ namespace LINGYUN.Abp.LocalizationManagement;
typeof(LocalizationStoreInMemoryCache))]
public class LocalizationStoreInMemoryCache : ILocalizationStoreCache, ISingletonDependency
{
private string _cacheStamp;
private DateTime? _lastCheckTime;
private readonly SemaphoreSlim _syncSemaphore;
public string CacheStamp { get; set; }
public DateTime? LastCheckTime { get; set; }
public SemaphoreSlim SyncSemaphore { get; } = new(1, 1);
protected LocalizationResourceDictionary Resources { get; }
protected LocalizationLanguageDictionary Languages { get; }
@ -51,7 +52,6 @@ public class LocalizationStoreInMemoryCache : ILocalizationStoreCache, ISingleto
_distributedCacheOptions = distributedCacheOptions.Value;
_managementOptions = managementOptions.Value;
_syncSemaphore = new SemaphoreSlim(1, 1);
Resources = new LocalizationResourceDictionary();
Languages = new LocalizationLanguageDictionary();
LocalizedStrings = new LocalizationDictionaryWithResource();
@ -59,7 +59,7 @@ public class LocalizationStoreInMemoryCache : ILocalizationStoreCache, ISingleto
public async virtual Task InitializeAsync(LocalizationStoreCacheInitializeContext context)
{
using (await _syncSemaphore.LockAsync())
using (await SyncSemaphore.LockAsync())
{
await EnsureCacheIsUptoDateAsync(context);
}
@ -133,24 +133,24 @@ public class LocalizationStoreInMemoryCache : ILocalizationStoreCache, ISingleto
protected async virtual Task EnsureCacheIsUptoDateAsync(LocalizationStoreCacheInitializeContext context)
{
if (_lastCheckTime.HasValue &&
_clock.Now.Subtract(_lastCheckTime.Value).TotalSeconds < 30)
if (LastCheckTime.HasValue &&
_clock.Now.Subtract(LastCheckTime.Value).TotalSeconds < 30)
{
return;
}
var stampInDistributedCache = await GetOrSetStampInDistributedCache();
if (stampInDistributedCache == _cacheStamp)
if (stampInDistributedCache == CacheStamp)
{
_lastCheckTime = _clock.Now;
LastCheckTime = _clock.Now;
return;
}
await UpdateInMemoryStoreCache(context);
_cacheStamp = stampInDistributedCache;
_lastCheckTime = _clock.Now;
CacheStamp = stampInDistributedCache;
LastCheckTime = _clock.Now;
}
protected async virtual Task UpdateInMemoryStoreCache(LocalizationStoreCacheInitializeContext context)

5
aspnet-core/modules/mvc/LINGYUN.Abp.AspNetCore.Mvc.Wrapper/LINGYUN/Abp/AspNetCore/Mvc/HttpResponseWrapper.cs

@ -16,7 +16,6 @@ public class HttpResponseWrapper : IHttpResponseWrapper, ITransientDependency
public virtual void Wrap(HttpResponseWrapperContext context)
{
context.HttpContext.Response.Headers.Add(AbpHttpWrapConsts.AbpWrapResult, "true");
context.HttpContext.Response.StatusCode = context.HttpStatusCode;
if (context.HttpHeaders != null)
{
@ -28,5 +27,9 @@ public class HttpResponseWrapper : IHttpResponseWrapper, ITransientDependency
}
}
}
if (!context.HttpContext.Response.Headers.ContainsKey(AbpHttpWrapConsts.AbpWrapResult))
{
context.HttpContext.Response.Headers.Add(AbpHttpWrapConsts.AbpWrapResult, "true");
}
}
}

5
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.LinkUser/LINGYUN/Abp/OpenIddict/LinkUser/AbpOpenIddictLinkUserModule.cs

@ -1,5 +1,4 @@
using LINGYUN.Abp.OpenIddict.LinkUser.Controllers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.OpenIddict;
@ -27,7 +26,7 @@ public class AbpOpenIddictLinkUserModule : AbpModule
{
options.Grants.TryAdd(
LinkUserTokenExtensionGrantConsts.GrantType,
new LinkUserTokenController());
new LinkUserTokenExtensionGrant());
});
Configure<AbpVirtualFileSystemOptions>(options =>

109
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.LinkUser/LINGYUN/Abp/OpenIddict/LinkUser/Controllers/TokenController.LinkUser.cs → aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.LinkUser/LINGYUN/Abp/OpenIddict/LinkUser/LinkUserTokenExtensionGrant.cs

@ -1,37 +1,35 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using OpenIddict.Abstractions;
using OpenIddict.Server;
using OpenIddict.Server.AspNetCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.OpenIddict;
using Volo.Abp.OpenIddict.Controllers;
using Volo.Abp.OpenIddict.ExtensionGrantTypes;
using Volo.Abp.OpenIddict.Localization;
using Volo.Abp.Security.Claims;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
using SignInResult = Microsoft.AspNetCore.Mvc.SignInResult;
namespace LINGYUN.Abp.OpenIddict.LinkUser.Controllers;
[IgnoreAntiforgeryToken]
[ApiExplorerSettings(IgnoreApi = true)]
public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtensionGrant
namespace LINGYUN.Abp.OpenIddict.LinkUser;
public class LinkUserTokenExtensionGrant : ITokenExtensionGrant
{
public string Name => LinkUserTokenExtensionGrantConsts.GrantType;
protected ICurrentPrincipalAccessor CurrentPrincipalAccessor => LazyServiceProvider.LazyGetRequiredService<ICurrentPrincipalAccessor>();
protected IdentityLinkUserManager IdentityLinkUserManager => LazyServiceProvider.LazyGetRequiredService<IdentityLinkUserManager>();
protected IdentitySecurityLogManager IdentitySecurityLogManager => LazyServiceProvider.LazyGetRequiredService<IdentitySecurityLogManager>();
public async virtual Task<IActionResult> HandleAsync(ExtensionGrantContext context)
{
LazyServiceProvider = context.HttpContext.RequestServices.GetRequiredService<IAbpLazyServiceProvider>();
var localizer = GetRequiredService<IStringLocalizer<AbpOpenIddictResource>>(context);
// 用户需要传递身份令牌
var accessTokenParam = context.Request.GetParameter("access_token");
var accessToken = accessTokenParam.ToString();
@ -40,14 +38,14 @@ public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtens
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = L["InvalidAccessToken"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = localizer["InvalidAccessToken"]
});
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
// 通过身份令牌得到用户信息
var transaction = await context.HttpContext.RequestServices.GetRequiredService<IOpenIddictServerFactory>().CreateTransactionAsync();
var transaction = await GetRequiredService<IOpenIddictServerFactory>(context).CreateTransactionAsync();
transaction.EndpointType = OpenIddictServerEndpointType.Userinfo;
transaction.Request = new OpenIddictRequest
{
@ -57,7 +55,7 @@ public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtens
};
var notification = new OpenIddictServerEvents.ProcessAuthenticationContext(transaction);
var dispatcher = context.HttpContext.RequestServices.GetRequiredService<IOpenIddictServerDispatcher>();
var dispatcher = GetRequiredService<IOpenIddictServerDispatcher>(context);
await dispatcher.DispatchAsync(notification);
if (notification.IsRejected)
@ -86,8 +84,11 @@ public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtens
}
var userId = principal.FindUserId();
var currentTenant = GetRequiredService<ICurrentTenant>(context);
var currentPrincipalAccessor = GetRequiredService<ICurrentPrincipalAccessor>(context);
// 交换令牌
using (CurrentPrincipalAccessor.Change(principal))
using (currentPrincipalAccessor.Change(principal))
{
var linkUserIdParam = context.Request.GetParameter("LinkUserId");
if (!linkUserIdParam.HasValue || !Guid.TryParse(linkUserIdParam.Value.ToString(), out var linkUserId))
@ -95,7 +96,7 @@ public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtens
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = L["InvalidLinkUserId"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = localizer["InvalidLinkUserId"]
});
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
@ -110,7 +111,7 @@ public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtens
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = L["InvalidLinkTenantId"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = localizer["InvalidLinkTenantId"]
});
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
@ -119,15 +120,18 @@ public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtens
linkTenantId = parsedGuid;
}
var isLinked = await IdentityLinkUserManager.IsLinkedAsync(
new IdentityLinkUserInfo(userId.Value, CurrentTenant.Id),
var userManager = GetRequiredService<IdentityUserManager>(context);
var linkUserManager = GetRequiredService<IdentityLinkUserManager>(context);
var isLinked = await linkUserManager.IsLinkedAsync(
new IdentityLinkUserInfo(userId.Value, currentTenant.Id),
new IdentityLinkUserInfo(linkUserId, linkTenantId));
if (isLinked)
{
using (CurrentTenant.Change(linkTenantId))
using (currentTenant.Change(linkTenantId))
{
var linkUser = await UserManager.GetByIdAsync(linkUserId);
var linkUser = await userManager.GetByIdAsync(linkUserId);
return await SetSuccessResultAsync(context, linkUser);
}
@ -137,7 +141,7 @@ public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtens
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = L["TheTargetUserIsNotLinkedToYou"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = localizer["TheTargetUserIsNotLinkedToYou"]
});
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
@ -145,23 +149,32 @@ public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtens
}
}
protected virtual async Task<IActionResult> SetSuccessResultAsync(ExtensionGrantContext context, IdentityUser user)
protected virtual T GetRequiredService<T>(ExtensionGrantContext context)
{
return context.HttpContext.RequestServices.GetRequiredService<T>();
}
protected async virtual Task<IActionResult> SetSuccessResultAsync(ExtensionGrantContext context, IdentityUser user)
{
Logger.LogInformation("Credentials validated for username: {username}", user.UserName);
var logger = GetRequiredService<ILogger<LinkUserTokenExtensionGrant>>(context);
var principal = await SignInManager.CreateUserPrincipalAsync(user);
logger.LogInformation("Credentials validated for username: {username}", user.UserName);
var signInManager = GetRequiredService<SignInManager<IdentityUser>>(context);
var principal = await signInManager.CreateUserPrincipalAsync(user);
principal.SetScopes(context.Request.GetScopes());
principal.SetResources(await GetResourcesAsync(context.Request.GetScopes()));
principal.SetResources(await GetResourcesAsync(context));
await SetClaimsDestinationsAsync(principal);
await SetClaimsDestinationsAsync(context, principal);
await SaveSecurityLogAsync(
context,
user,
OpenIddictSecurityLogActionConsts.LoginSucceeded);
return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
return new SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, principal);
}
protected async virtual Task SaveSecurityLogAsync(
@ -178,11 +191,45 @@ public class LinkUserTokenController : AbpOpenIdDictControllerBase, ITokenExtens
};
logContext.WithProperty("GrantType", Name);
await IdentitySecurityLogManager.SaveAsync(logContext);
var identitySecurityLogManager = GetRequiredService<IdentitySecurityLogManager>(context);
await identitySecurityLogManager.SaveAsync(logContext);
}
protected virtual Task<string> FindClientIdAsync(ExtensionGrantContext context)
{
return Task.FromResult(context.Request.ClientId);
}
protected async virtual Task SetClaimsDestinationsAsync(ExtensionGrantContext context, ClaimsPrincipal principal)
{
var claimDestinationsManager = GetRequiredService<AbpOpenIddictClaimDestinationsManager>(context);
await claimDestinationsManager.SetAsync(principal);
}
protected async virtual Task<IEnumerable<string>> GetResourcesAsync(ExtensionGrantContext context)
{
var scopes = context.Request.GetScopes();
var resources = new List<string>();
if (!scopes.Any())
{
return resources;
}
var scopeManager = GetRequiredService<IOpenIddictScopeManager>(context);
await foreach (var resource in scopeManager.ListResourcesAsync(scopes))
{
resources.Add(resource);
}
return resources;
}
public virtual ForbidResult Forbid(AuthenticationProperties properties, params string[] authenticationSchemes)
{
return new ForbidResult(
authenticationSchemes,
properties);
}
}

2
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Sms/LINGYUN/Abp/OpenIddict/Sms/AbpOpenIddictSmsModule.cs

@ -30,7 +30,7 @@ public class AbpOpenIddictSmsModule : AbpModule
{
options.Grants.TryAdd(
SmsTokenExtensionGrantConsts.GrantType,
new SmsTokenController());
new SmsTokenExtensionGrant());
});
Configure<AbpVirtualFileSystemOptions>(options =>

119
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Sms/LINGYUN/Abp/OpenIddict/Sms/Controllers/TokenController.Sms.cs → aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Sms/LINGYUN/Abp/OpenIddict/Sms/SmsTokenExtensionGrant.cs

@ -2,48 +2,46 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OpenIddict.Abstractions;
using OpenIddict.Server.AspNetCore;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.Identity.Localization;
using Volo.Abp.OpenIddict;
using Volo.Abp.OpenIddict.Controllers;
using Volo.Abp.OpenIddict.ExtensionGrantTypes;
using Volo.Abp.OpenIddict.Localization;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
using IIdentityUserRepository = LINGYUN.Abp.Identity.IIdentityUserRepository;
using SignInResult = Microsoft.AspNetCore.Mvc.SignInResult;
namespace LINGYUN.Abp.OpenIddict.Sms;
[IgnoreAntiforgeryToken]
[ApiExplorerSettings(IgnoreApi = true)]
public class SmsTokenController : AbpOpenIdDictControllerBase, ITokenExtensionGrant
public class SmsTokenExtensionGrant : ITokenExtensionGrant
{
protected IOptions<IdentityOptions> IdentityOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<IdentityOptions>>();
protected IIdentityUserRepository UserRepository => LazyServiceProvider.LazyGetRequiredService<IIdentityUserRepository>();
protected IdentitySecurityLogManager IdentitySecurityLogManager => LazyServiceProvider.LazyGetRequiredService<IdentitySecurityLogManager>();
public string Name => SmsTokenExtensionGrantConsts.GrantType;
public async virtual Task<IActionResult> HandleAsync(ExtensionGrantContext context)
{
LazyServiceProvider = context.HttpContext.RequestServices.GetRequiredService<IAbpLazyServiceProvider>();
var logger = GetRequiredService<ILogger<SmsTokenExtensionGrant>>(context);
var identityOptions = GetRequiredService<IOptions<IdentityOptions>>(context);
var localizer = GetRequiredService<IStringLocalizer<AbpOpenIddictResource>>(context);
var phoneNumberParam = context.Request.GetParameter(SmsTokenExtensionGrantConsts.ParamName);
var phoneTokenParam = context.Request.GetParameter(SmsTokenExtensionGrantConsts.TokenName);
if (!phoneNumberParam.HasValue || !phoneTokenParam.HasValue)
{
Logger.LogInformation("Invalid grant type: phone number or token code not found");
logger.LogInformation("Invalid grant type: phone number or token code not found");
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = L["InvalidGrant:PhoneOrTokenCodeNotFound"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = localizer["InvalidGrant:PhoneOrTokenCodeNotFound"]
});
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
@ -52,30 +50,35 @@ public class SmsTokenController : AbpOpenIdDictControllerBase, ITokenExtensionGr
var phoneToken = phoneTokenParam.Value.ToString();
var phoneNumber = phoneNumberParam.Value.ToString();
await IdentityOptions.SetAsync();
await identityOptions.SetAsync();
var userRepo = GetRequiredService<IIdentityUserRepository>(context);
var currentUser = await UserRepository.FindByPhoneNumberAsync(phoneNumber);
var currentUser = await userRepo.FindByPhoneNumberAsync(phoneNumber);
if (currentUser == null)
{
Logger.LogInformation("Invalid grant type: phone number not register");
logger.LogInformation("Invalid grant type: phone number not register");
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = L["InvalidGrant:PhoneNumberNotRegister"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = localizer["InvalidGrant:PhoneNumberNotRegister"]
});
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
if (await UserManager.IsLockedOutAsync(currentUser))
var userManager = GetRequiredService<IdentityUserManager>(context);
if (await userManager.IsLockedOutAsync(currentUser))
{
Logger.LogInformation("Authentication failed for username: {username}, reason: locked out", currentUser.UserName);
logger.LogInformation("Authentication failed for username: {username}, reason: locked out", currentUser.UserName);
var identityLocalizer = GetRequiredService<IStringLocalizer<IdentityResource>>(context);
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = L["Volo.Abp.Identity:UserLockedOut"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = identityLocalizer["Volo.Abp.Identity:UserLockedOut"]
});
await SaveSecurityLogAsync(context, currentUser, OpenIddictSecurityLogActionConsts.LoginLockedout);
@ -83,23 +86,23 @@ public class SmsTokenController : AbpOpenIdDictControllerBase, ITokenExtensionGr
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
var validResult = await UserManager.VerifyTwoFactorTokenAsync(currentUser, TokenOptions.DefaultPhoneProvider, phoneToken);
var validResult = await userManager.VerifyTwoFactorTokenAsync(currentUser, TokenOptions.DefaultPhoneProvider, phoneToken);
if (!validResult)
{
Logger.LogWarning("Authentication failed for token: {0}, reason: invalid token", phoneToken);
logger.LogWarning("Authentication failed for token: {0}, reason: invalid token", phoneToken);
string errorDescription;
var identityResult = await UserManager.AccessFailedAsync(currentUser);
var identityResult = await userManager.AccessFailedAsync(currentUser);
if (identityResult.Succeeded)
{
errorDescription = L["InvalidGrant:PhoneVerifyInvalid"];
errorDescription = localizer["InvalidGrant:PhoneVerifyInvalid"];
}
else
{
Logger.LogInformation("Authentication failed for username: {username}, reason: access failed", currentUser.UserName);
logger.LogInformation("Authentication failed for username: {username}, reason: access failed", currentUser.UserName);
errorDescription = identityResult.LocalizeErrors(L);
errorDescription = identityResult.LocalizeErrors(localizer);
}
await SaveSecurityLogAsync(context, currentUser, SmsTokenExtensionGrantConsts.SecurityCodeFailed);
@ -113,28 +116,38 @@ public class SmsTokenController : AbpOpenIdDictControllerBase, ITokenExtensionGr
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
(await UserManager.UpdateSecurityStampAsync(currentUser)).CheckErrors();
(await userManager.UpdateSecurityStampAsync(currentUser)).CheckErrors();
return await SetSuccessResultAsync(context, currentUser, logger);
}
return await SetSuccessResultAsync(context, currentUser);
protected virtual T GetRequiredService<T>(ExtensionGrantContext context)
{
return context.HttpContext.RequestServices.GetRequiredService<T>();
}
protected virtual async Task<IActionResult> SetSuccessResultAsync(ExtensionGrantContext context, IdentityUser user)
protected async virtual Task<IActionResult> SetSuccessResultAsync(
ExtensionGrantContext context,
IdentityUser user,
ILogger<SmsTokenExtensionGrant> logger)
{
Logger.LogInformation("Credentials validated for username: {username}", user.UserName);
logger.LogInformation("Credentials validated for username: {username}", user.UserName);
var principal = await SignInManager.CreateUserPrincipalAsync(user);
var signInManager = GetRequiredService<SignInManager<IdentityUser>>(context);
var principal = await signInManager.CreateUserPrincipalAsync(user);
principal.SetScopes(context.Request.GetScopes());
principal.SetResources(await GetResourcesAsync(context.Request.GetScopes()));
principal.SetResources(await GetResourcesAsync(context));
await SetClaimsDestinationsAsync(principal);
await SetClaimsDestinationsAsync(context, principal);
await SaveSecurityLogAsync(
context,
user,
OpenIddictSecurityLogActionConsts.LoginSucceeded);
return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
return new SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, principal);
}
protected async virtual Task SaveSecurityLogAsync(
@ -151,11 +164,45 @@ public class SmsTokenController : AbpOpenIdDictControllerBase, ITokenExtensionGr
};
logContext.WithProperty("GrantType", Name);
await IdentitySecurityLogManager.SaveAsync(logContext);
var identitySecurityLogManager = GetRequiredService<IdentitySecurityLogManager>(context);
await identitySecurityLogManager.SaveAsync(logContext);
}
protected virtual Task<string> FindClientIdAsync(ExtensionGrantContext context)
{
return Task.FromResult(context.Request.ClientId);
}
protected async virtual Task SetClaimsDestinationsAsync(ExtensionGrantContext context, ClaimsPrincipal principal)
{
var claimDestinationsManager = GetRequiredService<AbpOpenIddictClaimDestinationsManager>(context);
await claimDestinationsManager.SetAsync(principal);
}
protected async virtual Task<IEnumerable<string>> GetResourcesAsync(ExtensionGrantContext context)
{
var scopes = context.Request.GetScopes();
var resources = new List<string>();
if (!scopes.Any())
{
return resources;
}
var scopeManager = GetRequiredService<IOpenIddictScopeManager>(context);
await foreach (var resource in scopeManager.ListResourcesAsync(scopes))
{
resources.Add(resource);
}
return resources;
}
public virtual ForbidResult Forbid(AuthenticationProperties properties, params string[] authenticationSchemes)
{
return new ForbidResult(
authenticationSchemes,
properties);
}
}

5
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/AbpOpenIddictWeChatModule.cs

@ -1,5 +1,4 @@
using LINGYUN.Abp.Identity.WeChat;
using LINGYUN.Abp.OpenIddict.WeChat.Controllers;
using LINGYUN.Abp.WeChat.MiniProgram;
using LINGYUN.Abp.WeChat.Official;
using Microsoft.Extensions.DependencyInjection;
@ -36,11 +35,11 @@ public class AbpOpenIddictWeChatModule : AbpModule
{
options.Grants.TryAdd(
WeChatTokenExtensionGrantConsts.OfficialGrantType,
new WeChatOfficialTokenController());
new WeChatOffcialTokenExtensionGrant());
options.Grants.TryAdd(
WeChatTokenExtensionGrantConsts.MiniProgramGrantType,
new WeChatMiniProgramTokenController());
new WeChatMiniProgramTokenExtensionGrant());
});
Configure<AbpVirtualFileSystemOptions>(options =>

33
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/Controllers/TokenController.WeChat.MiniProgram.cs

@ -1,33 +0,0 @@
using LINGYUN.Abp.WeChat.MiniProgram;
using LINGYUN.Abp.WeChat.MiniProgram.Features;
using LINGYUN.Abp.WeChat.OpenId;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.OpenIddict.ExtensionGrantTypes;
namespace LINGYUN.Abp.OpenIddict.WeChat.Controllers;
public class WeChatMiniProgramTokenController : WeChatTokenController
{
public override string Name => WeChatTokenExtensionGrantConsts.MiniProgramGrantType;
public override string LoginProvider => AbpWeChatMiniProgramConsts.ProviderName;
public override string AuthenticationMethod => AbpWeChatMiniProgramConsts.AuthenticationMethod;
protected async override Task CheckFeatureAsync(ExtensionGrantContext context)
{
if (!await FeatureChecker.IsEnabledAsync(WeChatMiniProgramFeatures.EnableAuthorization))
{
throw new AbpException(L["MiniProgramAuthorizationDisabledMessage"]);
}
}
protected async override Task<WeChatOpenId> FindOpenIdAsync(string code)
{
var optionsFactory = LazyServiceProvider.LazyGetRequiredService<AbpWeChatMiniProgramOptionsFactory>();
var options = await optionsFactory.CreateAsync();
return await WeChatOpenIdFinder.FindAsync(code, options.AppId, options.AppSecret);
}
}

32
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/Controllers/TokenController.WeChat.Official.cs

@ -1,32 +0,0 @@
using LINGYUN.Abp.WeChat.Official;
using LINGYUN.Abp.WeChat.Official.Features;
using LINGYUN.Abp.WeChat.OpenId;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.OpenIddict.ExtensionGrantTypes;
namespace LINGYUN.Abp.OpenIddict.WeChat.Controllers;
public class WeChatOfficialTokenController : WeChatTokenController
{
public override string Name => WeChatTokenExtensionGrantConsts.OfficialGrantType;
public override string LoginProvider => AbpWeChatOfficialConsts.ProviderName;
public override string AuthenticationMethod => AbpWeChatOfficialConsts.AuthenticationMethod;
protected async override Task CheckFeatureAsync(ExtensionGrantContext context)
{
if (!await FeatureChecker.IsEnabledAsync(WeChatOfficialFeatures.EnableAuthorization))
{
throw new AbpException(L["OfficialAuthorizationDisabledMessage"]);
}
}
protected async override Task<WeChatOpenId> FindOpenIdAsync(string code)
{
var optionsFactory = LazyServiceProvider.LazyGetRequiredService<AbpWeChatOfficialOptionsFactory>();
var options = await optionsFactory.CreateAsync();
return await WeChatOpenIdFinder.FindAsync(code, options.AppId, options.AppSecret);
}
}

41
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/WeChatMiniProgramTokenExtensionGrant.cs

@ -0,0 +1,41 @@
using LINGYUN.Abp.WeChat.MiniProgram;
using LINGYUN.Abp.WeChat.MiniProgram.Features;
using LINGYUN.Abp.WeChat.OpenId;
using Microsoft.Extensions.Localization;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Features;
using Volo.Abp.OpenIddict.ExtensionGrantTypes;
using Volo.Abp.OpenIddict.Localization;
namespace LINGYUN.Abp.OpenIddict.WeChat;
public class WeChatMiniProgramTokenExtensionGrant : WeChatTokenExtensionGrant
{
public override string Name => WeChatTokenExtensionGrantConsts.MiniProgramGrantType;
public override string LoginProvider => AbpWeChatMiniProgramConsts.ProviderName;
public override string AuthenticationMethod => AbpWeChatMiniProgramConsts.AuthenticationMethod;
protected async override Task CheckFeatureAsync(ExtensionGrantContext context)
{
var featureChecker = GetRequiredService<IFeatureChecker>(context);
if (!await featureChecker.IsEnabledAsync(WeChatMiniProgramFeatures.EnableAuthorization))
{
var localizer = GetRequiredService<IStringLocalizer<AbpOpenIddictResource>>(context);
throw new AbpException(localizer["MiniProgramAuthorizationDisabledMessage"]);
}
}
protected async override Task<WeChatOpenId> FindOpenIdAsync(ExtensionGrantContext context, string code)
{
var weChatOpenIdFinder = GetRequiredService<IWeChatOpenIdFinder>(context);
var optionsFactory = GetRequiredService<AbpWeChatMiniProgramOptionsFactory>(context);
var options = await optionsFactory.CreateAsync();
return await weChatOpenIdFinder.FindAsync(code, options.AppId, options.AppSecret);
}
}

41
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/WeChatOffcialTokenExtensionGrant.cs

@ -0,0 +1,41 @@
using LINGYUN.Abp.WeChat.Official;
using LINGYUN.Abp.WeChat.Official.Features;
using LINGYUN.Abp.WeChat.OpenId;
using Microsoft.Extensions.Localization;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Features;
using Volo.Abp.OpenIddict.ExtensionGrantTypes;
using Volo.Abp.OpenIddict.Localization;
namespace LINGYUN.Abp.OpenIddict.WeChat;
public class WeChatOffcialTokenExtensionGrant : WeChatTokenExtensionGrant
{
public override string Name => WeChatTokenExtensionGrantConsts.OfficialGrantType;
public override string LoginProvider => AbpWeChatOfficialConsts.ProviderName;
public override string AuthenticationMethod => AbpWeChatOfficialConsts.AuthenticationMethod;
protected async override Task CheckFeatureAsync(ExtensionGrantContext context)
{
var featureChecker = GetRequiredService<IFeatureChecker>(context);
if (!await featureChecker.IsEnabledAsync(WeChatOfficialFeatures.EnableAuthorization))
{
var localizer = GetRequiredService<IStringLocalizer<AbpOpenIddictResource>>(context);
throw new AbpException(localizer["OfficialAuthorizationDisabledMessage"]);
}
}
protected async override Task<WeChatOpenId> FindOpenIdAsync(ExtensionGrantContext context, string code)
{
var weChatOpenIdFinder = GetRequiredService<IWeChatOpenIdFinder>(context);
var optionsFactory = GetRequiredService<AbpWeChatOfficialOptionsFactory>(context);
var options = await optionsFactory.CreateAsync();
return await weChatOpenIdFinder.FindAsync(code, options.AppId, options.AppSecret);
}
}

147
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/Controllers/TokenController.WeChat.cs → aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/WeChatTokenExtensionGrant.cs

@ -1,6 +1,6 @@
using LINGYUN.Abp.WeChat;
using LINGYUN.Abp.WeChat.Localization;
using LINGYUN.Abp.WeChat.OpenId;
using LINGYUN.Abp.WeChat.Security.Claims;
using LINGYUN.Abp.WeChat.Settings;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
@ -12,38 +12,32 @@ using OpenIddict.Abstractions;
using OpenIddict.Server.AspNetCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Identity;
using Volo.Abp.Identity.Localization;
using Volo.Abp.MultiTenancy;
using Volo.Abp.OpenIddict;
using Volo.Abp.OpenIddict.Controllers;
using Volo.Abp.OpenIddict.ExtensionGrantTypes;
using Volo.Abp.OpenIddict.Localization;
using Volo.Abp.Settings;
using IdentityResource = Volo.Abp.Identity.Localization.IdentityResource;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
using SignInResult = Microsoft.AspNetCore.Mvc.SignInResult;
namespace LINGYUN.Abp.OpenIddict.WeChat.Controllers;
namespace LINGYUN.Abp.OpenIddict.WeChat;
[IgnoreAntiforgeryToken]
[ApiExplorerSettings(IgnoreApi = true)]
public abstract class WeChatTokenController : AbpOpenIdDictControllerBase, ITokenExtensionGrant
public abstract class WeChatTokenExtensionGrant : ITokenExtensionGrant
{
public abstract string Name { get; }
public abstract string LoginProvider { get; }
public abstract string AuthenticationMethod { get; }
protected abstract Task<WeChatOpenId> FindOpenIdAsync(string code);
protected IWeChatOpenIdFinder WeChatOpenIdFinder => LazyServiceProvider.LazyGetRequiredService<IWeChatOpenIdFinder>();
protected ISettingProvider SettingProvider => LazyServiceProvider.LazyGetRequiredService<ISettingProvider>();
protected IdentitySecurityLogManager IdentitySecurityLogManager => LazyServiceProvider.LazyGetRequiredService<IdentitySecurityLogManager>();
protected IStringLocalizer<IdentityResource> IdentityLocalizer => LazyServiceProvider.LazyGetRequiredService<IStringLocalizer<IdentityResource>>();
protected abstract Task<WeChatOpenId> FindOpenIdAsync(ExtensionGrantContext context, string code);
public async virtual Task<IActionResult> HandleAsync(ExtensionGrantContext context)
{
LazyServiceProvider = context.HttpContext.RequestServices.GetRequiredService<IAbpLazyServiceProvider>();
await CheckFeatureAsync(context);
return await HandleWeChatAsync(context);
@ -51,16 +45,19 @@ public abstract class WeChatTokenController : AbpOpenIdDictControllerBase, IToke
protected async virtual Task<IActionResult> HandleWeChatAsync(ExtensionGrantContext context)
{
var logger = GetRequiredService<ILogger<WeChatTokenExtensionGrant>>(context);
var localizer = GetRequiredService<IStringLocalizer<AbpOpenIddictResource>>(context);
var wechatCodeParam = context.Request.GetParameter(AbpWeChatGlobalConsts.TokenName);
var wechatCode = wechatCodeParam.ToString();
if (wechatCode.IsNullOrWhiteSpace())
{
Logger.LogWarning("Invalid grant type: wechat code not found");
logger.LogWarning("Invalid grant type: wechat code not found");
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = L["InvalidGrant:WeChatCodeNotFound"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = localizer["InvalidGrant:WeChatCodeNotFound"]
});
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
@ -69,7 +66,7 @@ public abstract class WeChatTokenController : AbpOpenIdDictControllerBase, IToke
WeChatOpenId wechatOpenId;
try
{
wechatOpenId = await FindOpenIdAsync(wechatCode);
wechatOpenId = await FindOpenIdAsync(context, wechatCode);
}
catch (AbpWeChatException e)
{
@ -81,28 +78,35 @@ public abstract class WeChatTokenController : AbpOpenIdDictControllerBase, IToke
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
var currentUser = await UserManager.FindByLoginAsync(LoginProvider, wechatOpenId.OpenId);
var userManager = GetRequiredService<IdentityUserManager>(context);
var currentUser = await userManager.FindByLoginAsync(LoginProvider, wechatOpenId.OpenId);
if (currentUser == null)
{
var currentTenant = GetRequiredService<ICurrentTenant>(context);
var settingProvider = GetRequiredService<ISettingProvider>(context);
var guidGenerator = GetRequiredService<IGuidGenerator>(context);
// TODO 检查启用用户注册是否有必要引用账户模块
if (!await SettingProvider.IsTrueAsync("Abp.Account.IsSelfRegistrationEnabled") ||
!await SettingProvider.IsTrueAsync(WeChatSettingNames.EnabledQuickLogin))
if (!await settingProvider.IsTrueAsync("Abp.Account.IsSelfRegistrationEnabled") ||
!await settingProvider.IsTrueAsync(WeChatSettingNames.EnabledQuickLogin))
{
Logger.LogWarning("Invalid grant type: wechat openid not register", wechatOpenId.OpenId);
logger.LogWarning("Invalid grant type: wechat openid not register", wechatOpenId.OpenId);
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = L["InvalidGrant:WeChatNotRegister"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = localizer["InvalidGrant:WeChatNotRegister"]
});
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
var userName = "wxid-" + wechatOpenId.OpenId.ToMd5().ToLower();
var userEmail = $"{userName}@{CurrentTenant.Name ?? "default"}.io";
currentUser = new IdentityUser(GuidGenerator.Create(), userName, userEmail, CurrentTenant.Id);
(await UserManager.CreateAsync(currentUser)).CheckErrors();
(await UserManager.AddLoginAsync(
var userEmail = $"{userName}@{currentTenant.Name ?? "default"}.io";
currentUser = new IdentityUser(guidGenerator.Create(), userName, userEmail, currentTenant.Id);
(await userManager.CreateAsync(currentUser)).CheckErrors();
(await userManager.AddLoginAsync(
currentUser,
new UserLoginInfo(
LoginProvider,
@ -111,14 +115,16 @@ public abstract class WeChatTokenController : AbpOpenIdDictControllerBase, IToke
}
// 检查是否已锁定
if (await UserManager.IsLockedOutAsync(currentUser))
if (await userManager.IsLockedOutAsync(currentUser))
{
Logger.LogInformation("Authentication failed for username: {username}, reason: locked out", currentUser.UserName);
var identityLocalizer = GetRequiredService<IStringLocalizer<IdentityResource>>(context);
logger.LogInformation("Authentication failed for username: {username}, reason: locked out", currentUser.UserName);
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = IdentityLocalizer["Volo.Abp.Identity:UserLockedOut"]
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = identityLocalizer["Volo.Abp.Identity:UserLockedOut"]
});
await SaveSecurityLogAsync(context, currentUser, wechatOpenId, OpenIddictSecurityLogActionConsts.LoginLockedout);
@ -127,11 +133,9 @@ public abstract class WeChatTokenController : AbpOpenIdDictControllerBase, IToke
}
// 登录之后需要更新安全令牌
(await UserManager.UpdateSecurityStampAsync(currentUser)).CheckErrors();
(await userManager.UpdateSecurityStampAsync(currentUser)).CheckErrors();
await SetSuccessResultAsync(context, currentUser, wechatOpenId);
return await SetSuccessResultAsync(context, currentUser, wechatOpenId);
return await SetSuccessResultAsync(context, currentUser, wechatOpenId, logger);
}
protected virtual Task CheckFeatureAsync(ExtensionGrantContext context)
@ -139,16 +143,37 @@ public abstract class WeChatTokenController : AbpOpenIdDictControllerBase, IToke
return Task.CompletedTask;
}
protected async virtual Task<IActionResult> SetSuccessResultAsync(ExtensionGrantContext context, IdentityUser user, WeChatOpenId wechatOpenId)
protected virtual T GetRequiredService<T>(ExtensionGrantContext context)
{
return context.HttpContext.RequestServices.GetRequiredService<T>();
}
protected async virtual Task<IActionResult> SetSuccessResultAsync(
ExtensionGrantContext context,
IdentityUser user,
WeChatOpenId wechatOpenId,
ILogger<WeChatTokenExtensionGrant> logger)
{
Logger.LogInformation("Credentials validated for username: {username}", user.UserName);
logger.LogInformation("Credentials validated for username: {username}", user.UserName);
var principal = await SignInManager.CreateUserPrincipalAsync(user);
var signInManager = GetRequiredService<SignInManager<IdentityUser>>(context);
var principal = await signInManager.CreateUserPrincipalAsync(user);
principal.SetScopes(context.Request.GetScopes());
principal.SetResources(await GetResourcesAsync(context.Request.GetScopes()));
principal.SetResources(await GetResourcesAsync(context));
await SetClaimsDestinationsAsync(principal);
if (!wechatOpenId.OpenId.IsNullOrWhiteSpace())
{
principal.AddClaim(AbpWeChatClaimTypes.OpenId, wechatOpenId.OpenId);
}
if (!wechatOpenId.UnionId.IsNullOrWhiteSpace())
{
principal.AddClaim(AbpWeChatClaimTypes.UnionId, wechatOpenId.UnionId);
}
await SetClaimsDestinationsAsync(context, principal);
await SaveSecurityLogAsync(
context,
@ -156,7 +181,7 @@ public abstract class WeChatTokenController : AbpOpenIdDictControllerBase, IToke
wechatOpenId,
OpenIddictSecurityLogActionConsts.LoginSucceeded);
return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
return new SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, principal);
}
protected async virtual Task SaveSecurityLogAsync(
@ -176,11 +201,45 @@ public abstract class WeChatTokenController : AbpOpenIdDictControllerBase, IToke
logContext.WithProperty("Provider", LoginProvider);
logContext.WithProperty("Method", AuthenticationMethod);
await IdentitySecurityLogManager.SaveAsync(logContext);
var identitySecurityLogManager = GetRequiredService<IdentitySecurityLogManager>(context);
await identitySecurityLogManager.SaveAsync(logContext);
}
protected virtual Task<string> FindClientIdAsync(ExtensionGrantContext context)
{
return Task.FromResult(context.Request?.ClientId);
return Task.FromResult(context.Request.ClientId);
}
protected async virtual Task SetClaimsDestinationsAsync(ExtensionGrantContext context, ClaimsPrincipal principal)
{
var claimDestinationsManager = GetRequiredService<AbpOpenIddictClaimDestinationsManager>(context);
await claimDestinationsManager.SetAsync(principal);
}
protected async virtual Task<IEnumerable<string>> GetResourcesAsync(ExtensionGrantContext context)
{
var scopes = context.Request.GetScopes();
var resources = new List<string>();
if (!scopes.Any())
{
return resources;
}
var scopeManager = GetRequiredService<IOpenIddictScopeManager>(context);
await foreach (var resource in scopeManager.ListResourcesAsync(scopes))
{
resources.Add(resource);
}
return resources;
}
public virtual ForbidResult Forbid(AuthenticationProperties properties, params string[] authenticationSchemes)
{
return new ForbidResult(
authenticationSchemes,
properties);
}
}

1
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN.Abp.Saas.Domain.Shared.csproj

@ -17,6 +17,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Auditing.Contracts" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Validation" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>

5
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/AbpSaasDomainSharedModule.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.Saas.Localization;
using Volo.Abp.Auditing;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Modularity;
@ -7,7 +8,9 @@ using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Abp.Saas;
[DependsOn(typeof(AbpValidationModule))]
[DependsOn(
typeof(AbpValidationModule),
typeof(AbpAuditingContractsModule))]
public class AbpSaasDomainSharedModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

5
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Editions/EditionEto.cs

@ -1,11 +1,14 @@
using System;
using Volo.Abp.Auditing;
namespace LINGYUN.Abp.Saas.Editions;
[Serializable]
public class EditionEto
public class EditionEto : IHasEntityVersion
{
public Guid Id { get; set; }
public string DisplayName { get; set; }
public int EntityVersion { get; set; }
}

5
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantEto.cs

@ -1,11 +1,14 @@
using System;
using Volo.Abp.Auditing;
namespace LINGYUN.Abp.Saas.Tenants;
[Serializable]
public class TenantEto
public class TenantEto : IHasEntityVersion
{
public Guid Id { get; set; }
public string Name { get; set; }
public int EntityVersion { get; set; }
}

5
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Editions/Edition.cs

@ -1,14 +1,17 @@
using JetBrains.Annotations;
using System;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities.Auditing;
namespace LINGYUN.Abp.Saas.Editions;
public class Edition : FullAuditedAggregateRoot<Guid>
public class Edition : FullAuditedAggregateRoot<Guid>, IHasEntityVersion
{
public virtual string DisplayName { get; protected set; }
public virtual int EntityVersion { get; protected set; }
protected Edition()
{
}

6
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Tenants/Tenant.cs

@ -5,11 +5,12 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities.Auditing;
namespace LINGYUN.Abp.Saas.Tenants;
public class Tenant : FullAuditedAggregateRoot<Guid>
public class Tenant : FullAuditedAggregateRoot<Guid>, IHasEntityVersion
{
protected const string DefaultConnectionStringName = Volo.Abp.Data.ConnectionStrings.DefaultConnectionStringName;
@ -22,8 +23,11 @@ public class Tenant : FullAuditedAggregateRoot<Guid>
public virtual DateTime? DisableTime { get; protected set; }
public virtual Guid? EditionId { get; set; }
public virtual Edition Edition { get; set; }
public virtual int EntityVersion { get; protected set; }
public virtual ICollection<TenantConnectionString> ConnectionStrings { get; protected set; }
protected Tenant()

27
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobTypeSelector.cs

@ -7,13 +7,13 @@ public class JobTypeSelector : NamedTypeSelector
public JobTypeSelector(
string name,
Func<Type, bool> predicate,
int lockTimeOut = 0,
int? lockTimeOut = null,
string nodeName = null,
string cron = null,
JobPriority priority = JobPriority.Normal,
int interval = 300,
int tryCount = 0,
int maxTryCount = 50)
JobPriority? priority = null,
int? interval = null,
int? maxCount = null,
int? maxTryCount = null)
: base(name, predicate)
{
LockTimeOut = lockTimeOut;
@ -21,17 +21,15 @@ public class JobTypeSelector : NamedTypeSelector
Cron = cron;
Priority = priority;
Interval = interval;
TryCount = tryCount;
MaxCount = maxCount;
MaxTryCount = maxTryCount;
}
/// <summary>
/// 任务独占超时时长(秒)
/// 0或更小不生效
/// </summary>
public int LockTimeOut { get; set; }
public int? LockTimeOut { get; set; }
/// <summary>
/// 指定运行节点
/// </summary>
@ -39,23 +37,22 @@ public class JobTypeSelector : NamedTypeSelector
/// <summary>
/// 任务优先级
/// </summary>
public JobPriority Priority { get; set; } = JobPriority.Normal;
public JobPriority? Priority { get; set; }
/// <summary>
/// Cron表达式,如果是周期性任务需要指定
/// </summary>
public string Cron { get; set; }
/// <summary>
/// 间隔时间,单位秒,与Cron表达式冲突
/// 默认: 300
/// </summary>
public int Interval { get; set; } = 300;
public int? Interval { get; set; }
/// <summary>
/// 失败重试次数
/// 最大触发次数
/// </summary>
public int TryCount { get; set; }
public int? MaxCount { get; set; }
/// <summary>
/// 失败重试上限
/// 默认:50
/// </summary>
public int MaxTryCount { get; set; } = 50;
public int? MaxTryCount { get; set; }
}

10
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundJobManager.cs

@ -88,11 +88,11 @@ public class BackgroundJobManager : IBackgroundJobManager, ITransientDependency
.JobDispatcherSelectors
.FirstOrDefault(x => x.Predicate(jobConfiguration.JobType));
jobInfo.Interval = selector.Interval;
jobInfo.LockTimeOut = selector.LockTimeOut;
jobInfo.Priority = selector.Priority;
jobInfo.TryCount = selector.TryCount;
jobInfo.MaxTryCount = selector.MaxTryCount;
jobInfo.Interval = selector.Interval ?? jobInfo.Interval;
jobInfo.LockTimeOut = selector.LockTimeOut ?? jobInfo.LockTimeOut;
jobInfo.Priority = selector.Priority ?? jobInfo.Priority;
jobInfo.TryCount = selector.MaxCount ?? jobInfo.MaxCount;
jobInfo.MaxTryCount = selector.MaxTryCount ?? jobInfo.MaxTryCount;
if (!selector.NodeName.IsNullOrWhiteSpace())
{

10
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerManager.cs

@ -62,11 +62,11 @@ public class BackgroundWorkerManager : IBackgroundWorkerManager, ISingletonDepen
.JobDispatcherSelectors
.FirstOrDefault(x => x.Predicate(workerType));
jobInfo.Interval = selector.Interval;
jobInfo.LockTimeOut = selector.LockTimeOut;
jobInfo.Priority = selector.Priority;
jobInfo.TryCount = selector.TryCount;
jobInfo.MaxTryCount = selector.MaxTryCount;
jobInfo.Interval = selector.Interval ?? jobInfo.Interval;
jobInfo.LockTimeOut = selector.LockTimeOut ?? jobInfo.LockTimeOut;
jobInfo.Priority = selector.Priority ?? jobInfo.Priority;
jobInfo.TryCount = selector.MaxCount ?? jobInfo.MaxCount;
jobInfo.MaxTryCount = selector.MaxTryCount ?? jobInfo.MaxTryCount;
if (!selector.NodeName.IsNullOrWhiteSpace())
{

2
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionDto.cs

@ -10,6 +10,8 @@ public class TextTemplateDefinitionDto : IHasConcurrencyStamp
public bool IsInlineLocalized { get; set; }
public bool IsLayout { get; set; }
public string Layout { get; set; }
public string LayoutName { get; set; }
public bool IsStatic { get; set; }
public string ConcurrencyStamp { get; set; }
public string FormatedDisplayName { get; set; }
}

2
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionGetListInput.cs

@ -5,4 +5,6 @@ namespace LINGYUN.Abp.TextTemplating;
public class TextTemplateDefinitionGetListInput : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
public bool? IsStatic { get; set; }
public bool? IsLayout { get; set; }
}

4
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs

@ -6,6 +6,8 @@ public class AbpTextTemplatingApplicationAutoMapperProfile : Profile
{
public AbpTextTemplatingApplicationAutoMapperProfile()
{
CreateMap<TextTemplateDefinition, TextTemplateDefinitionDto>();
CreateMap<TextTemplateDefinition, TextTemplateDefinitionDto>()
.ForMember(dto => dto.LayoutName, src => src.Ignore())
.ForMember(dto => dto.FormatedDisplayName, src => src.Ignore());
}
}

37
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionAppService.cs

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
@ -72,8 +73,10 @@ public class TextTemplateDefinitionAppService : AbpTextTemplatingAppServiceBase,
IsInlineLocalized = templateDefinition.IsInlineLocalized,
IsLayout = templateDefinition.IsLayout,
Layout = layout,
LayoutName = templateDefinition.Layout,
Name = templateDefinition.Name,
DisplayName = formatDisplayName,
FormatedDisplayName = templateDefinition.DisplayName,
IsStatic = templateDefinition.IsStatic,
ConcurrencyStamp = templateDefinition.ConcurrencyStamp,
};
@ -104,8 +107,10 @@ public class TextTemplateDefinitionAppService : AbpTextTemplatingAppServiceBase,
IsInlineLocalized = template.IsInlineLocalized,
IsLayout = template.IsLayout,
Layout = layout,
LayoutName = template.Layout,
Name = template.Name,
DisplayName = await template.DisplayName.LocalizeAsync(StringLocalizerFactory),
FormatedDisplayName = _localizableStringSerializer.Serialize(template.DisplayName),
};
var staticState = template.Properties.GetOrDefault(nameof(TextTemplateDefinition.IsStatic));
@ -123,17 +128,23 @@ public class TextTemplateDefinitionAppService : AbpTextTemplatingAppServiceBase,
var templateDefinitions = await _store.GetAllAsync();
var templateDefinitionFilter = templateDefinitions.AsQueryable()
.WhereIf(!input.Filter.IsNullOrWhiteSpace(), x =>
x.Name.Contains(input.Filter) ||
(!x.Layout.IsNullOrWhiteSpace() && x.Layout.Contains(input.Filter)))
.WhereIf(input.IsStatic.HasValue, x => input.IsStatic == IsStatic(x))
.WhereIf(input.IsLayout.HasValue, x => x.IsLayout == input.IsLayout);
var sorting = input.Sorting;
if (sorting.IsNullOrWhiteSpace())
{
sorting = nameof(TextTemplateDefinition.Name);
}
var filterTemplates = templateDefinitions.AsQueryable()
.WhereIf(!input.Filter.IsNullOrWhiteSpace(), x =>
x.Name.Contains(input.Filter) || x.Layout.Contains(input.Filter))
var filterTemplateCount = templateDefinitionFilter.Count();
var filterTemplates = templateDefinitionFilter
.OrderBy(sorting)
.Skip(input.SkipCount)
.Take(input.MaxResultCount);
.PageBy(input.SkipCount, input.MaxResultCount);
foreach (var templateDefinition in filterTemplates)
{
@ -153,8 +164,10 @@ public class TextTemplateDefinitionAppService : AbpTextTemplatingAppServiceBase,
IsInlineLocalized = templateDefinition.IsInlineLocalized,
IsLayout = templateDefinition.IsLayout,
Layout = layout,
LayoutName = templateDefinition.Layout,
Name = templateDefinition.Name,
DisplayName = templateDefinition.DisplayName.Localize(StringLocalizerFactory),
FormatedDisplayName = _localizableStringSerializer.Serialize(templateDefinition.DisplayName),
};
var staticState = templateDefinition.Properties.GetOrDefault(nameof(TextTemplateDefinition.IsStatic));
@ -166,7 +179,7 @@ public class TextTemplateDefinitionAppService : AbpTextTemplatingAppServiceBase,
templates.Add(result);
}
return new PagedResultDto<TextTemplateDefinitionDto>(templateDefinitions.Count, templates);
return new PagedResultDto<TextTemplateDefinitionDto>(filterTemplateCount, templates);
}
[Authorize(AbpTextTemplatingPermissions.TextTemplateDefinition.Update)]
@ -228,8 +241,10 @@ public class TextTemplateDefinitionAppService : AbpTextTemplatingAppServiceBase,
IsInlineLocalized = templateDefinitionRecord.IsInlineLocalized,
IsLayout = templateDefinitionRecord.IsLayout,
Layout = layout,
LayoutName = templateDefinitionRecord.Layout,
Name = templateDefinitionRecord.Name,
DisplayName = displayName,
FormatedDisplayName = templateDefinitionRecord.DisplayName,
IsStatic = templateDefinitionRecord.IsStatic,
ConcurrencyStamp = templateDefinitionRecord.ConcurrencyStamp,
};
@ -254,4 +269,14 @@ public class TextTemplateDefinitionAppService : AbpTextTemplatingAppServiceBase,
templateDefinition.RenderEngine = input.RenderEngine;
}
}
private bool IsStatic(TemplateDefinition definition)
{
if (definition.Properties.TryGetValue(nameof(TextTemplateDefinition.IsStatic), out var isStaticObj) &&
isStaticObj is bool isStatic)
{
return isStatic;
}
return false;
}
}

1
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/en.json

@ -20,6 +20,7 @@
"TextTemplating:01100": "Text template {Name} already exists!",
"TextTemplating:01404": "No text template named {Name} found!",
"TextTemplates": "Text Templates",
"TextTemplates:AddNew": "New Template",
"Contents": "Contents",
"Layout": "Layout",
"LocalizationResource": "Localization Resource",

1
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/zh-Hans.json

@ -20,6 +20,7 @@
"TextTemplating:01100": "文本模板 {Name} 已经存在!",
"TextTemplating:01404": "没有找到名为 {Name} 的文本模板!",
"TextTemplates": "文本模板",
"TextTemplates:AddNew": "新模板",
"Contents": "内容",
"Layout": "布局页",
"LocalizationResource": "本地化资源",

16
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionEto.cs

@ -0,0 +1,16 @@
using System;
namespace LINGYUN.Abp.TextTemplating;
public class TextTemplateDefinitionEto
{
public Guid Id { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public bool IsLayout { get; set; }
public string Layout { get; set; }
public bool IsInlineLocalized { get; set; }
public string DefaultCultureName { get; set; }
public string RenderEngine { get; set; }
public bool IsStatic { get; set; }
}

13
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateEto.cs

@ -0,0 +1,13 @@
using System;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.TextTemplating;
public class TextTemplateEto : IMultiTenant
{
public Guid? TenantId { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public string Content { get; set; }
public string Culture { get; set; }
}

7
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj

@ -4,15 +4,12 @@
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<None Remove="LINGYUN\Abp\TextTemplating\55rcuzt3.mzx~" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Caching" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.TextTemplating.Core" Version="$(VoloAbpPackageVersion)" />

16
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs

@ -2,8 +2,10 @@
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.AutoMapper;
using Volo.Abp.Caching;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.Modularity;
using Volo.Abp.TextTemplating;
using Volo.Abp.Threading;
@ -13,6 +15,7 @@ namespace LINGYUN.Abp.TextTemplating;
[DependsOn(
typeof(AbpTextTemplatingDomainSharedModule),
typeof(AbpTextTemplatingCoreModule),
typeof(AbpAutoMapperModule),
typeof(AbpCachingModule))]
public class AbpTextTemplatingDomainModule : AbpModule
{
@ -20,6 +23,19 @@ public class AbpTextTemplatingDomainModule : AbpModule
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<AbpTextTemplatingDomainModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<TextTemplateMapperProfile>(validate: true);
});
Configure<AbpDistributedEntityEventOptions>(options =>
{
options.EtoMappings.Add<TextTemplate, TextTemplateEto>();
options.EtoMappings.Add<TextTemplateDefinition, TextTemplateDefinitionEto>();
});
if (context.Services.IsDataMigrationEnvironment())
{
Configure<AbpTextTemplatingCachingOptions>(options =>

78
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TemplateDefinitionStoreCacheInvalidator.cs

@ -0,0 +1,78 @@
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Options;
using System;
using System.Threading.Tasks;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Threading;
using Volo.Abp.Timing;
namespace LINGYUN.Abp.TextTemplating;
public class TemplateDefinitionStoreCacheInvalidator :
ILocalEventHandler<EntityChangedEventData<TextTemplateDefinition>>,
IDistributedEventHandler<EntityCreatedEto<TextTemplateDefinitionEto>>,
IDistributedEventHandler<EntityUpdatedEto<TextTemplateDefinitionEto>>,
IDistributedEventHandler<EntityDeletedEto<TextTemplateDefinitionEto>>,
ITransientDependency
{
private readonly ITemplateDefinitionStoreCache _storeCache;
private readonly IClock _clock;
private readonly IDistributedCache _distributedCache;
private readonly AbpDistributedCacheOptions _cacheOptions;
public TemplateDefinitionStoreCacheInvalidator(
IClock clock,
IDistributedCache distributedCache,
ITemplateDefinitionStoreCache storeCache,
IOptions<AbpDistributedCacheOptions> cacheOptions)
{
_storeCache = storeCache;
_clock = clock;
_distributedCache = distributedCache;
_cacheOptions = cacheOptions.Value;
}
public async virtual Task HandleEventAsync(EntityChangedEventData<TextTemplateDefinition> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityCreatedEto<TextTemplateDefinitionEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityUpdatedEto<TextTemplateDefinitionEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
public async virtual Task HandleEventAsync(EntityDeletedEto<TextTemplateDefinitionEto> eventData)
{
await RemoveStampInDistributedCacheAsync();
}
protected async virtual Task RemoveStampInDistributedCacheAsync()
{
using (await _storeCache.SyncSemaphore.LockAsync())
{
var cacheKey = GetCommonStampCacheKey();
await _distributedCache.RemoveAsync(cacheKey);
_storeCache.CacheStamp = Guid.NewGuid().ToString();
_storeCache.LastCheckTime = _clock.Now.AddMinutes(-5);
}
}
protected virtual string GetCommonStampCacheKey()
{
return $"{_cacheOptions.KeyPrefix}_AbpInMemoryTemplateDefinitionCacheStamp";
}
}

6
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateCacheItemInvalidator.cs

@ -14,9 +14,9 @@ public class TextTemplateCacheItemInvalidator :
{
protected ICurrentTenant CurrentTenant { get; }
protected IDistributedCache<TemplateContentCacheItem> Cache { get; }
protected IDistributedCache<TextTemplateContentCacheItem> Cache { get; }
public TextTemplateCacheItemInvalidator(IDistributedCache<TemplateContentCacheItem> cache, ICurrentTenant currentTenant)
public TextTemplateCacheItemInvalidator(IDistributedCache<TextTemplateContentCacheItem> cache, ICurrentTenant currentTenant)
{
Cache = cache;
CurrentTenant = currentTenant;
@ -47,6 +47,6 @@ public class TextTemplateCacheItemInvalidator :
protected virtual string CalculateCacheKey(string name, string culture = null)
{
return TemplateContentCacheItem.CalculateCacheKey(name, culture);
return TextTemplateContentCacheItem.CalculateCacheKey(name, culture);
}
}

6
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TemplateContentCacheItem.cs → aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentCacheItem.cs

@ -3,19 +3,19 @@
namespace LINGYUN.Abp.TextTemplating;
[Serializable]
public class TemplateContentCacheItem
public class TextTemplateContentCacheItem
{
private const string CacheKeyFormat = "pn:template-content,n:{0},c:{1}";
public string Name { get; set; }
public string Culture { get; set; }
public string Content { get; set; }
public TemplateContentCacheItem()
public TextTemplateContentCacheItem()
{
}
public TemplateContentCacheItem(
public TextTemplateContentCacheItem(
string name,
string content,
string culture = null)

10
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentContributor.cs

@ -11,10 +11,10 @@ namespace LINGYUN.Abp.TextTemplating;
public class TextTemplateContentContributor : ITemplateContentContributor, ITransientDependency
{
protected AbpTextTemplatingCachingOptions TemplatingCachingOptions { get; }
protected IDistributedCache<TemplateContentCacheItem> TextTemplateContentCache { get; }
protected IDistributedCache<TextTemplateContentCacheItem> TextTemplateContentCache { get; }
public TextTemplateContentContributor(
IDistributedCache<TemplateContentCacheItem> textTemplateContentCache,
IDistributedCache<TextTemplateContentCacheItem> textTemplateContentCache,
IOptions<AbpTextTemplatingCachingOptions> templatingCachingOptions)
{
TextTemplateContentCache = textTemplateContentCache;
@ -23,7 +23,7 @@ public class TextTemplateContentContributor : ITemplateContentContributor, ITran
public async virtual Task<string> GetOrNullAsync(TemplateContentContributorContext context)
{
var cacheKey = TemplateContentCacheItem.CalculateCacheKey(context.TemplateDefinition.Name, context.Culture);
var cacheKey = TextTemplateContentCacheItem.CalculateCacheKey(context.TemplateDefinition.Name, context.Culture);
var cacheItem = await TextTemplateContentCache.GetOrAddAsync(cacheKey,
() => CreateTemplateContentCache(context),
@ -32,12 +32,12 @@ public class TextTemplateContentContributor : ITemplateContentContributor, ITran
return cacheItem?.Content;
}
protected async virtual Task<TemplateContentCacheItem> CreateTemplateContentCache(TemplateContentContributorContext context)
protected async virtual Task<TextTemplateContentCacheItem> CreateTemplateContentCache(TemplateContentContributorContext context)
{
var repository = context.ServiceProvider.GetRequiredService<ITextTemplateRepository>();
var template = await repository.FindByNameAsync(context.TemplateDefinition.Name, context.Culture);
return new TemplateContentCacheItem(
return new TextTemplateContentCacheItem(
template?.Name,
template?.Content,
template?.Culture);

11
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateMapperProfile.cs

@ -0,0 +1,11 @@
using AutoMapper;
namespace LINGYUN.Abp.TextTemplating;
public class TextTemplateMapperProfile : Profile
{
public TextTemplateMapperProfile()
{
CreateMap<TextTemplate, TextTemplateEto>();
CreateMap<TextTemplateDefinition, TextTemplateDefinitionEto>();
}
}

2
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/IDynamicWebhookDefinitionStore.cs

@ -9,5 +9,7 @@ public interface IDynamicWebhookDefinitionStore
Task<IReadOnlyList<WebhookDefinition>> GetWebhooksAsync();
Task<WebhookGroupDefinition> GetGroupOrNullAsync(string name);
Task<IReadOnlyList<WebhookGroupDefinition>> GetGroupsAsync();
}

2
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/IStaticWebhookDefinitionStore.cs

@ -9,5 +9,7 @@ public interface IStaticWebhookDefinitionStore
Task<IReadOnlyList<WebhookDefinition>> GetWebhooksAsync();
Task<WebhookGroupDefinition> GetGroupOrNullAsync(string name);
Task<IReadOnlyList<WebhookGroupDefinition>> GetGroupsAsync();
}

15
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/IWebhookDefinitionManager.cs

@ -11,13 +11,13 @@ namespace LINGYUN.Abp.Webhooks
/// Gets a webhook definition by name.
/// Returns null if there is no webhook definition with given name.
/// </summary>
[NotNull]
Task<WebhookDefinition> GetOrNullAsync(string name);
/// <summary>
/// Gets a webhook definition by name.
/// Throws exception if there is no webhook definition with given name.
/// </summary>
[NotNull]
Task<WebhookDefinition> GetAsync(string name);
/// <summary>
@ -25,6 +25,19 @@ namespace LINGYUN.Abp.Webhooks
/// </summary>
Task<IReadOnlyList<WebhookDefinition>> GetWebhooksAsync();
/// <summary>
/// Gets a webhook group definition by name.
/// Returns null if there is no webhook group definition with given name.
/// </summary>
Task<WebhookGroupDefinition> GetGroupOrNullAsync(string name);
/// <summary>
/// Gets a webhook definition by name.
/// Throws exception if there is no webhook group definition with given name.
/// </summary>
[NotNull]
Task<WebhookGroupDefinition> GetGroupAsync(string name);
/// <summary>
/// Gets all webhook group definitions.
/// </summary>

7
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/NullDynamicWebhookDefinitionStore.cs

@ -11,6 +11,8 @@ public class NullDynamicWebhookDefinitionStore : IDynamicWebhookDefinitionStore,
{
private readonly static Task<WebhookDefinition> CachedWebhookResult = Task.FromResult((WebhookDefinition)null);
private readonly static Task<WebhookGroupDefinition> CachedWebhookGroupResult = Task.FromResult((WebhookGroupDefinition)null);
private readonly static Task<IReadOnlyList<WebhookDefinition>> CachedWebhooksResult =
Task.FromResult((IReadOnlyList<WebhookDefinition>)Array.Empty<WebhookDefinition>().ToImmutableList());
@ -31,4 +33,9 @@ public class NullDynamicWebhookDefinitionStore : IDynamicWebhookDefinitionStore,
{
return CachedGroupsResult;
}
public Task<WebhookGroupDefinition> GetGroupOrNullAsync(string name)
{
return CachedWebhookGroupResult;
}
}

9
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/StaticWebhookDefinitionStore.cs

@ -80,7 +80,7 @@ public class StaticWebhookDefinitionStore : IStaticWebhookDefinitionStore, ISing
return definitions;
}
public Task<WebhookDefinition> GetOrNullAsync(string name)
public virtual Task<WebhookDefinition> GetOrNullAsync(string name)
{
return Task.FromResult(WebhookDefinitions.GetOrDefault(name));
}
@ -92,10 +92,15 @@ public class StaticWebhookDefinitionStore : IStaticWebhookDefinitionStore, ISing
);
}
public Task<IReadOnlyList<WebhookGroupDefinition>> GetGroupsAsync()
public virtual Task<IReadOnlyList<WebhookGroupDefinition>> GetGroupsAsync()
{
return Task.FromResult<IReadOnlyList<WebhookGroupDefinition>>(
WebhookGroupDefinitions.Values.ToImmutableList()
);
}
public virtual Task<WebhookGroupDefinition> GetGroupOrNullAsync(string name)
{
return Task.FromResult(WebhookGroupDefinitions.GetOrDefault(name));
}
}

5
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/WebhookDefinition.cs

@ -11,6 +11,11 @@ namespace LINGYUN.Abp.Webhooks
/// </summary>
public string Name { get; }
// <summary>
/// Group name of the webhook.
/// </summary>
public string GroupName { get; internal set; }
/// <summary>
/// Display name of the webhook.
/// Optional.

19
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/WebhookDefinitionManager.cs

@ -60,6 +60,25 @@ namespace LINGYUN.Abp.Webhooks
.ToImmutableList();
}
public async virtual Task<WebhookGroupDefinition> GetGroupOrNullAsync(string name)
{
Check.NotNull(name, nameof(name));
return await _staticStore.GetGroupOrNullAsync(name) ??
await _dynamicStore.GetGroupOrNullAsync(name);
}
public async virtual Task<WebhookGroupDefinition> GetGroupAsync(string name)
{
var webhookGroup = await GetGroupOrNullAsync(name);
if (webhookGroup == null)
{
throw new AbpException("Undefined webhook group: " + name);
}
return webhookGroup;
}
public async virtual Task<IReadOnlyList<WebhookGroupDefinition>> GetGroupsAsync()
{
var staticGroups = await _staticStore.GetGroupsAsync();

7
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/WebhookGroupDefinition.cs

@ -56,7 +56,10 @@ public class WebhookGroupDefinition
name,
displayName,
description
);
)
{
GroupName = Name
};
_webhooks.Add(webhook);
@ -71,6 +74,8 @@ public class WebhookGroupDefinition
{
throw new AbpException($"There is already an existing webhook with name: {webhook.Name} in group {Name}");
}
webhook.GroupName = Name;
}
_webhooks.AddRange(webhooks);

30
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs

@ -116,30 +116,42 @@ namespace LINGYUN.Abp.Webhooks
{
foreach (var header in _options.DefaultHttpHeaders)
{
if (request.Headers.TryAddWithoutValidation(header.Key, header.Value))
if (!request.Headers.Contains(header.Key))
{
continue;
if (request.Headers.TryAddWithoutValidation(header.Key, header.Value))
{
continue;
}
}
if (request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value))
if (!request.Content.Headers.Contains(header.Key))
{
continue;
if (request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value))
{
continue;
}
}
}
foreach (var header in webhookSenderArgs.Headers)
{
if (request.Headers.TryAddWithoutValidation(header.Key, header.Value))
if (!request.Headers.Contains(header.Key))
{
continue;
if (request.Headers.TryAddWithoutValidation(header.Key, header.Value))
{
continue;
}
}
if (request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value))
if (!request.Content.Headers.Contains(header.Key))
{
continue;
if (request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value))
{
continue;
}
}
throw new Exception($"Invalid Header. SubscriptionId:{webhookSenderArgs.WebhookSubscriptionId},Header: {header.Key}:{header.Value}");
Logger.LogWarning($"Invalid Header. SubscriptionId:{webhookSenderArgs.WebhookSubscriptionId},Header: {header.Key}:{header.Value}");
}
}

34
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissionDefinitionProvider.cs

@ -13,6 +13,40 @@ public class WebhooksManagementPermissionDefinitionProvider : PermissionDefiniti
WebhooksManagementPermissions.GroupName,
L("Permission:WebhooksManagement"));
var webhookGroupDefinition = group.AddPermission(
WebhooksManagementPermissions.WebhookGroupDefinition.Default,
L("Permission:WebhookGroupDefinitions"),
MultiTenancySides.Host);
webhookGroupDefinition.AddChild(
WebhooksManagementPermissions.WebhookGroupDefinition.Create,
L("Permission:Create"),
MultiTenancySides.Host);
webhookGroupDefinition.AddChild(
WebhooksManagementPermissions.WebhookGroupDefinition.Update,
L("Permission:Update"),
MultiTenancySides.Host);
webhookGroupDefinition.AddChild(
WebhooksManagementPermissions.WebhookGroupDefinition.Delete,
L("Permission:Delete"),
MultiTenancySides.Host);
var webhookDefinition = group.AddPermission(
WebhooksManagementPermissions.WebhookDefinition.Default,
L("Permission:WebhookDefinitions"),
MultiTenancySides.Host);
webhookDefinition.AddChild(
WebhooksManagementPermissions.WebhookDefinition.Create,
L("Permission:Create"),
MultiTenancySides.Host);
webhookDefinition.AddChild(
WebhooksManagementPermissions.WebhookDefinition.Update,
L("Permission:Update"),
MultiTenancySides.Host);
webhookDefinition.AddChild(
WebhooksManagementPermissions.WebhookDefinition.Delete,
L("Permission:Delete"),
MultiTenancySides.Host);
var subscription = group.AddPermission(
WebhooksManagementPermissions.WebhookSubscription.Default,
L("Permission:Subscriptions"),

16
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissions.cs

@ -11,6 +11,22 @@ public static class WebhooksManagementPermissions
public const string ManageSettings = GroupName + ".ManageSettings";
public static class WebhookGroupDefinition
{
public const string Default = GroupName + ".GroupDefinitions";
public const string Create = Default + ".Create";
public const string Update = Default + ".Update";
public const string Delete = Default + ".Delete";
}
public static class WebhookDefinition
{
public const string Default = GroupName + ".Definitions";
public const string Create = Default + ".Create";
public const string Update = Default + ".Update";
public const string Delete = Default + ".Delete";
}
public static class WebhookSubscription
{
public const string Default = GroupName + ".Subscriptions";

16
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionCreateDto.cs

@ -0,0 +1,16 @@
using LINGYUN.Abp.WebhooksManagement.Definitions.Dto;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public class WebhookDefinitionCreateDto : WebhookDefinitionCreateOrUpdateDto
{
[Required]
[DynamicStringLength(typeof(WebhookDefinitionRecordConsts), nameof(WebhookGroupDefinitionRecordConsts.MaxNameLength))]
public string GroupName { get; set; }
[Required]
[DynamicStringLength(typeof(WebhookDefinitionRecordConsts), nameof(WebhookDefinitionRecordConsts.MaxNameLength))]
public string Name { get; set; }
}

22
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionCreateOrUpdateDto.cs

@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Data;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.WebhooksManagement.Definitions.Dto;
public abstract class WebhookDefinitionCreateOrUpdateDto : IHasExtraProperties
{
[Required]
[DynamicStringLength(typeof(WebhookDefinitionRecordConsts), nameof(WebhookDefinitionRecordConsts.MaxDisplayNameLength))]
public string DisplayName { get; set; }
[DynamicStringLength(typeof(WebhookDefinitionRecordConsts), nameof(WebhookDefinitionRecordConsts.MaxDescriptionLength))]
public string Description { get; set; }
public bool IsEnabled { get; set; }
[DynamicStringLength(typeof(WebhookDefinitionRecordConsts), nameof(WebhookDefinitionRecordConsts.MaxRequiredFeaturesLength))]
public string RequiredFeatures { get; set; }
public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary();
}

26
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionDto.cs

@ -0,0 +1,26 @@
using Volo.Abp.Data;
namespace LINGYUN.Abp.WebhooksManagement.Definitions.Dto;
public class WebhookDefinitionDto : IHasExtraProperties
{
public string GroupName { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public string FormatedDisplayName { get; set; }
public string Description { get; set; }
public string FormatedDescription { get; set; }
public bool IsEnabled { get; set; }
public bool IsStatic { get; set; }
public string RequiredFeatures { get; set; }
public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary();
}

8
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionGetListInput.cs

@ -0,0 +1,8 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public class WebhookDefinitionGetListInput : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
}

10
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookDefinitionUpdateDto.cs

@ -0,0 +1,10 @@
using LINGYUN.Abp.WebhooksManagement.Definitions.Dto;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public class WebhookDefinitionUpdateDto : WebhookDefinitionCreateOrUpdateDto, IHasConcurrencyStamp
{
[StringLength(40)]
public string ConcurrencyStamp { get; set; }
}

10
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionCreateDto.cs

@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public class WebhookGroupDefinitionCreateDto : WebhookGroupDefinitionCreateOrUpdateDto
{
[Required]
[DynamicStringLength(typeof(WebhookGroupDefinitionRecordConsts), nameof(WebhookGroupDefinitionRecordConsts.MaxNameLength))]
public string Name { get; set; }
}

13
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionCreateOrUpdateDto.cs

@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Data;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public abstract class WebhookGroupDefinitionCreateOrUpdateDto : IHasExtraProperties
{
[Required]
[DynamicStringLength(typeof(WebhookGroupDefinitionRecordConsts), nameof(WebhookGroupDefinitionRecordConsts.MaxDisplayNameLength))]
public string DisplayName { get; set; }
public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary();
}

16
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionDto.cs

@ -0,0 +1,16 @@
using Volo.Abp.Data;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public class WebhookGroupDefinitionDto : IHasExtraProperties
{
public string Name { get; set; }
public string DisplayName { get; set; }
public string FormatedDisplayName { get; set; }
public bool IsStatic { get; set; }
public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary();
}

8
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionGetListInput.cs

@ -0,0 +1,8 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public class WebhookGroupDefinitionGetListInput : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
}

10
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/Dto/WebhookGroupDefinitionUpdateDto.cs

@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public class WebhookGroupDefinitionUpdateDto : WebhookGroupDefinitionCreateOrUpdateDto, IHasConcurrencyStamp
{
[StringLength(40)]
public string ConcurrencyStamp { get; set; }
}

19
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/IWebhookDefinitionAppService.cs

@ -0,0 +1,19 @@
using LINGYUN.Abp.WebhooksManagement.Definitions.Dto;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public interface IWebhookDefinitionAppService : IApplicationService
{
Task<WebhookDefinitionDto> GetAsync(string name);
Task DeleteAsync(string name);
Task<WebhookDefinitionDto> CreateAsync(WebhookDefinitionCreateDto input);
Task<WebhookDefinitionDto> UpdateAsync(string name, WebhookDefinitionUpdateDto input);
Task<PagedResultDto<WebhookDefinitionDto>> GetListAsync(WebhookDefinitionGetListInput input);
}

18
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Definitions/IWebhookGroupDefinitionAppService.cs

@ -0,0 +1,18 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.WebhooksManagement.Definitions;
public interface IWebhookGroupDefinitionAppService : IApplicationService
{
Task<WebhookGroupDefinitionDto> GetAsync(string name);
Task DeleteAysnc(string name);
Task<WebhookGroupDefinitionDto> CreateAsync(WebhookGroupDefinitionCreateDto input);
Task<WebhookGroupDefinitionDto> UpdateAsync(string name, WebhookGroupDefinitionUpdateDto input);
Task<PagedResultDto<WebhookGroupDefinitionDto>> GetListAsync(WebhookGroupDefinitionGetListInput input);
}

4
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSendRecordAppService.cs

@ -11,7 +11,11 @@ public interface IWebhookSendRecordAppService : IApplicationService
Task DeleteAsync(Guid id);
Task DeleteManyAsync(WebhookSendRecordDeleteManyInput input);
Task ResendAsync(Guid id);
Task ResendManyAsync(WebhookSendRecordResendManyInput input);
Task<PagedResultDto<WebhookSendRecordDto>> GetListAsync(WebhookSendRecordGetListInput input);
}

2
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSubscriptionAppService.cs

@ -13,5 +13,7 @@ public interface IWebhookSubscriptionAppService :
WebhookSubscriptionCreateInput,
WebhookSubscriptionUpdateInput>
{
Task DeleteManyAsync(WebhookSubscriptionDeleteManyInput input);
Task<ListResultDto<WebhookAvailableGroupDto>> GetAllAvailableWebhooksAsync();
}

8
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordDeleteManyInput.cs

@ -0,0 +1,8 @@
using System;
using System.Collections.Generic;
namespace LINGYUN.Abp.WebhooksManagement;
public class WebhookSendRecordDeleteManyInput
{
public List<Guid> RecordIds { get; set; } = new List<Guid>();
}

8
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordResendManyInput.cs

@ -0,0 +1,8 @@
using System;
using System.Collections.Generic;
namespace LINGYUN.Abp.WebhooksManagement;
public class WebhookSendRecordResendManyInput
{
public List<Guid> RecordIds { get; set; } = new List<Guid>();
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save