From 4a9f0ba8ae0fe77c999f7ed2fb8f0fa09cec6508 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 23 Jan 2023 17:54:11 +0300 Subject: [PATCH 01/31] Add HttpContext variable and skip it http interceptor logic when it is true --- .../core/src/lib/clients/http.client.ts | 30 +++++++++++++++++++ .../packages/core/src/lib/clients/index.ts | 1 + .../src/lib/interceptors/api.interceptor.ts | 4 +++ .../core/src/lib/tokens/http-context.token.ts | 3 ++ npm/ng-packs/packages/core/src/public-api.ts | 1 + 5 files changed, 39 insertions(+) create mode 100644 npm/ng-packs/packages/core/src/lib/clients/http.client.ts create mode 100644 npm/ng-packs/packages/core/src/lib/clients/index.ts create mode 100644 npm/ng-packs/packages/core/src/lib/tokens/http-context.token.ts diff --git a/npm/ng-packs/packages/core/src/lib/clients/http.client.ts b/npm/ng-packs/packages/core/src/lib/clients/http.client.ts new file mode 100644 index 0000000000..c6e9017be7 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/clients/http.client.ts @@ -0,0 +1,30 @@ +import { HttpClient, HttpContext, HttpRequest } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { IS_EXTERNAL_REQUEST } from '../tokens/http-context.token'; + +// source : https://github.com/armanozak/demo-angular-server-specific-interceptors +@Injectable({ + providedIn: 'root', +}) +export class ExternalHttpClient extends HttpClient { + override request( + first: string | HttpRequest, + url?: string, + options: RequestOptions = {}, + ): Observable { + if (typeof first === 'string') { + this.#setPlaceholderContext(options); + return super.request(first, url, options); + } + + this.#setPlaceholderContext(first); + return super.request(first); + } + #setPlaceholderContext(optionsOrRequest: { context?: HttpContext }) { + optionsOrRequest.context ??= new HttpContext(); + optionsOrRequest.context.set(IS_EXTERNAL_REQUEST, true); + } +} + +type RequestOptions = Parameters[2]; diff --git a/npm/ng-packs/packages/core/src/lib/clients/index.ts b/npm/ng-packs/packages/core/src/lib/clients/index.ts new file mode 100644 index 0000000000..c9aba4d030 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/clients/index.ts @@ -0,0 +1 @@ +export * from './http.client'; diff --git a/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts b/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts index d3dbe19ec0..aef5b9e706 100644 --- a/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts +++ b/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts @@ -5,6 +5,7 @@ import { finalize } from 'rxjs/operators'; import { SessionStateService } from '../services/session-state.service'; import { HttpWaitService } from '../services/http-wait.service'; import { TENANT_KEY } from '../tokens/tenant-key.token'; +import { IS_EXTERNAL_REQUEST } from '../tokens/http-context.token'; @Injectable({ providedIn: 'root', @@ -18,6 +19,9 @@ export class ApiInterceptor implements HttpInterceptor { ) {} intercept(request: HttpRequest, next: HttpHandler) { + if (request.context?.get(IS_EXTERNAL_REQUEST)) { + return next.handle(request); + } this.httpWaitService.addRequest(request); return next .handle( diff --git a/npm/ng-packs/packages/core/src/lib/tokens/http-context.token.ts b/npm/ng-packs/packages/core/src/lib/tokens/http-context.token.ts new file mode 100644 index 0000000000..e935232b08 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tokens/http-context.token.ts @@ -0,0 +1,3 @@ +import { HttpContextToken } from '@angular/common/http'; + +export const IS_EXTERNAL_REQUEST = new HttpContextToken(() => false); diff --git a/npm/ng-packs/packages/core/src/public-api.ts b/npm/ng-packs/packages/core/src/public-api.ts index a5cbd78e4e..e740b4c4df 100644 --- a/npm/ng-packs/packages/core/src/public-api.ts +++ b/npm/ng-packs/packages/core/src/public-api.ts @@ -23,3 +23,4 @@ export * from './lib/strategies'; export * from './lib/tokens'; export * from './lib/utils'; export * from './lib/validators'; +export * from './lib/clients'; From 395369f968a329e0a49e3b0b69ed2ee59d3d4c31 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 23 Jan 2023 19:06:27 +0300 Subject: [PATCH 02/31] HttpWait service always must call. with or without `IS_EXTERNAL_REQUEST`. --- .../core/src/lib/interceptors/api.interceptor.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts b/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts index aef5b9e706..e09bb6292e 100644 --- a/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts +++ b/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts @@ -19,16 +19,15 @@ export class ApiInterceptor implements HttpInterceptor { ) {} intercept(request: HttpRequest, next: HttpHandler) { - if (request.context?.get(IS_EXTERNAL_REQUEST)) { - return next.handle(request); - } this.httpWaitService.addRequest(request); - return next - .handle( - request.clone({ + const isExternalRequest = request.context?.get(IS_EXTERNAL_REQUEST); + const newRequest = isExternalRequest + ? request + : request.clone({ setHeaders: this.getAdditionalHeaders(request.headers), - }), - ) + }); + return next + .handle(newRequest) .pipe(finalize(() => this.httpWaitService.deleteRequest(request))); } From d361802de2b4512ae80ca8168aab23a6ba86d665 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 23 Jan 2023 19:08:05 +0300 Subject: [PATCH 03/31] Add documentation --- .../How-To-Skip-ABP-Headers-And-Interceptors.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md diff --git a/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md b/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md new file mode 100644 index 0000000000..b52f72b27c --- /dev/null +++ b/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md @@ -0,0 +1,10 @@ +# How to Skip HTTP interceptors and ABP headers + +The ABP Framework adds several HTTP headers to the HttpClient, such as the "Auth token" or "tenant Id." +ABP Server must possess the information but the ABP user may not want to send this informations to a external server. +ExternalHttpClient and IS EXTERNAL REQUEST HttpContext Token were added in V6.0.4. +THe ABP Http interceptors check value of `` token. Adding headers is skipped by the interceptor if it is present and its value is true. +The `ExternalHttpClient` extends from `HTTPClient` and set `IS_EXTERNAL_REQUEST` Context token to true. +When you are using `ExternalHttpClient` as HttpClient in your components, it does not add ABP-specific headers. + +Note: With `IS_EXTERNAL_REQUEST` or without, ABP loading service work. From 8c2f37bd3da4fb3f07f995d22e2dba4caf83b0a3 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 24 Jan 2023 09:54:47 +0300 Subject: [PATCH 04/31] Update doc --- docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md b/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md index b52f72b27c..2f3d51643b 100644 --- a/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md +++ b/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md @@ -3,7 +3,7 @@ The ABP Framework adds several HTTP headers to the HttpClient, such as the "Auth token" or "tenant Id." ABP Server must possess the information but the ABP user may not want to send this informations to a external server. ExternalHttpClient and IS EXTERNAL REQUEST HttpContext Token were added in V6.0.4. -THe ABP Http interceptors check value of `` token. Adding headers is skipped by the interceptor if it is present and its value is true. +THe ABP Http interceptors check value of `IS_EXTERNAL_REQUEST` token. When the token is True, ABP-specific headers don't add to Http Request. The `ExternalHttpClient` extends from `HTTPClient` and set `IS_EXTERNAL_REQUEST` Context token to true. When you are using `ExternalHttpClient` as HttpClient in your components, it does not add ABP-specific headers. From 857626a52324bb2568da64bb227f40568f4a058f Mon Sep 17 00:00:00 2001 From: Hamza Albreem <94292623+braim23@users.noreply.github.com> Date: Tue, 24 Jan 2023 10:00:48 +0300 Subject: [PATCH 05/31] quick fix for the How-To-Skip-ABP-Headers-And-Interceptors doc --- .../How-To-Skip-ABP-Headers-And-Interceptors.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md b/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md index 2f3d51643b..4c8a09f136 100644 --- a/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md +++ b/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md @@ -1,10 +1,10 @@ # How to Skip HTTP interceptors and ABP headers -The ABP Framework adds several HTTP headers to the HttpClient, such as the "Auth token" or "tenant Id." -ABP Server must possess the information but the ABP user may not want to send this informations to a external server. +The ABP Framework adds several HTTP headers to the HttpClient, such as the "Auth token" or "tenant Id". +The ABP Server must possess the information but the ABP user may not want to send this informations to an external server. ExternalHttpClient and IS EXTERNAL REQUEST HttpContext Token were added in V6.0.4. -THe ABP Http interceptors check value of `IS_EXTERNAL_REQUEST` token. When the token is True, ABP-specific headers don't add to Http Request. -The `ExternalHttpClient` extends from `HTTPClient` and set `IS_EXTERNAL_REQUEST` Context token to true. +The ABP Http interceptors check the value of the `IS_EXTERNAL_REQUEST` token. If the token is True then ABP-specific headers won't be added to Http Request. +The `ExternalHttpClient` extends from `HTTPClient` and sets the `IS_EXTERNAL_REQUEST` context token to true. When you are using `ExternalHttpClient` as HttpClient in your components, it does not add ABP-specific headers. -Note: With `IS_EXTERNAL_REQUEST` or without, ABP loading service work. +Note: With `IS_EXTERNAL_REQUEST` or without it, ABP loading service works. From 4a0704566a528460f1b89d068e7f92fcbabdf820 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 24 Jan 2023 10:51:16 +0300 Subject: [PATCH 06/31] add token index.ts, move doc HTTP Requests file --- docs/en/UI/Angular/HTTP-Requests.md | 12 ++++++++++++ .../How-To-Skip-ABP-Headers-And-Interceptors.md | 10 ---------- npm/ng-packs/packages/core/src/lib/tokens/index.ts | 1 + 3 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md diff --git a/docs/en/UI/Angular/HTTP-Requests.md b/docs/en/UI/Angular/HTTP-Requests.md index 57a058ef36..a0e53df9c9 100644 --- a/docs/en/UI/Angular/HTTP-Requests.md +++ b/docs/en/UI/Angular/HTTP-Requests.md @@ -298,3 +298,15 @@ export function handleHttpErrors(injector: Injector, httpError: HttpErrorRespons return throwError(httpError) } ``` + + +### How to Skip HTTP interceptors and ABP headers + +The ABP Framework adds several HTTP headers to the HttpClient, such as the "Auth token" or "tenant Id". +The ABP Server must possess the information but the ABP user may not want to send this informations to an external server. +ExternalHttpClient and IS EXTERNAL REQUEST HttpContext Token were added in V6.0.4. +The ABP Http interceptors check the value of the `IS_EXTERNAL_REQUEST` token. If the token is True then ABP-specific headers won't be added to Http Request. +The `ExternalHttpClient` extends from `HTTPClient` and sets the `IS_EXTERNAL_REQUEST` context token to true. +When you are using `ExternalHttpClient` as HttpClient in your components, it does not add ABP-specific headers. + +Note: With `IS_EXTERNAL_REQUEST` or without it, ABP loading service works. diff --git a/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md b/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md deleted file mode 100644 index 4c8a09f136..0000000000 --- a/docs/en/UI/Angular/How-To-Skip-ABP-Headers-And-Interceptors.md +++ /dev/null @@ -1,10 +0,0 @@ -# How to Skip HTTP interceptors and ABP headers - -The ABP Framework adds several HTTP headers to the HttpClient, such as the "Auth token" or "tenant Id". -The ABP Server must possess the information but the ABP user may not want to send this informations to an external server. -ExternalHttpClient and IS EXTERNAL REQUEST HttpContext Token were added in V6.0.4. -The ABP Http interceptors check the value of the `IS_EXTERNAL_REQUEST` token. If the token is True then ABP-specific headers won't be added to Http Request. -The `ExternalHttpClient` extends from `HTTPClient` and sets the `IS_EXTERNAL_REQUEST` context token to true. -When you are using `ExternalHttpClient` as HttpClient in your components, it does not add ABP-specific headers. - -Note: With `IS_EXTERNAL_REQUEST` or without it, ABP loading service works. diff --git a/npm/ng-packs/packages/core/src/lib/tokens/index.ts b/npm/ng-packs/packages/core/src/lib/tokens/index.ts index 98985107f3..e0116e007a 100644 --- a/npm/ng-packs/packages/core/src/lib/tokens/index.ts +++ b/npm/ng-packs/packages/core/src/lib/tokens/index.ts @@ -7,3 +7,4 @@ export * from './manage-profile.token'; export * from './options.token'; export * from './queue.token'; export * from './tenant-key.token'; +export * from './http-context.token'; From 4d086f4ed39f751ba521bc7b6892de697501912c Mon Sep 17 00:00:00 2001 From: Idrees Haddad Date: Fri, 27 Jan 2023 08:15:16 +0300 Subject: [PATCH 07/31] Update Modal.md Fixed a typo isModelOpen should be isModalOpen --- docs/en/UI/Angular/Modal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/UI/Angular/Modal.md b/docs/en/UI/Angular/Modal.md index 144f38e842..903e98f1fd 100644 --- a/docs/en/UI/Angular/Modal.md +++ b/docs/en/UI/Angular/Modal.md @@ -57,7 +57,7 @@ You can add the `abp-modal` to your component very quickly. See an example: @Component(/* component metadata */) export class SampleComponent { - isModelOpen = false + isModalOpen = false } ``` From ec742e9d24edfa04139babbffca3eb105212f6e6 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 30 Jan 2023 15:24:07 +0300 Subject: [PATCH 08/31] Cli: Fix wrong import when module added to angular project --- .../Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs index c8d3aeb75b..74a45ba7e1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs @@ -267,11 +267,11 @@ public class AngularSourceCodeAdder : ITransientDependency var fileContent = File.ReadAllText(filePath); - fileContent = "import { "+moduleName.Split(".").Last()+"Module } from '@"+moduleName.Split(".").Last().ToKebabCase()+"/config';" + Environment.NewLine + fileContent; + fileContent = "import { "+moduleName.Split(".").Last()+"ConfigModule } from '@"+moduleName.Split(".").Last().ToKebabCase()+"/config';" + Environment.NewLine + fileContent; fileContent = Regex.Replace(fileContent, "imports\\s*:\\s*\\[", "imports: ["+ Environment.NewLine + - " " + moduleName.Split(".").Last() + "Module.forRoot(),"); + " " + moduleName.Split(".").Last() + "ConfigModule.forRoot(),"); File.WriteAllText(filePath, fileContent); } From f3bce4b18b37704fad50e7c47bda9a47fcfe04ed Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 1 Feb 2023 21:13:17 +0800 Subject: [PATCH 09/31] Fix openiddict cache problem. --- .../OpenIddict/AbpOpenIddictDomainModule.cs | 3 ++ .../AbpOpenIddictIdentifierConverter.cs | 17 ++++++++ .../Abp/OpenIddict/AbpOpenIddictStoreBase.cs | 10 +++-- .../Applications/AbpApplicationManager.cs | 19 ++++++++- .../AbpOpenIddictApplicationCache.cs | 16 ++++---- .../AbpOpenIddictApplicationStore.cs | 5 ++- .../Authorizations/AbpAuthorizationManager.cs | 39 +++++++++++++++++++ .../AbpOpenIddictAuthorizationCache.cs | 16 ++++---- .../AbpOpenIddictAuthorizationStore.cs | 5 ++- .../Scopes/AbpOpenIddictScopeCache.cs | 8 ++-- .../Scopes/AbpOpenIddictScopeStore.cs | 5 ++- .../Abp/OpenIddict/Scopes/AbpScopeManager.cs | 39 +++++++++++++++++++ .../Tokens/AbpOpenIddictTokenStore.cs | 9 +++-- .../Abp/OpenIddict/Tokens/AbpTokenManager.cs | 39 +++++++++++++++++++ 14 files changed, 195 insertions(+), 35 deletions(-) create mode 100644 modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictIdentifierConverter.cs create mode 100644 modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpAuthorizationManager.cs create mode 100644 modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/AbpScopeManager.cs create mode 100644 modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/AbpTokenManager.cs diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictDomainModule.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictDomainModule.cs index 428f5a7062..c9ec33780e 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictDomainModule.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictDomainModule.cs @@ -71,6 +71,9 @@ public class AbpOpenIddictDomainModule : AbpModule .AddTokenStore(); builder.ReplaceApplicationManager(typeof(AbpApplicationManager)); + builder.ReplaceAuthorizationManager(typeof(AbpAuthorizationManager)); + builder.ReplaceScopeManager(typeof(AbpScopeManager)); + builder.ReplaceTokenManager(typeof(AbpTokenManager)); builder.Services.TryAddScoped(provider => (IAbpApplicationManager)provider.GetRequiredService()); diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictIdentifierConverter.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictIdentifierConverter.cs new file mode 100644 index 0000000000..3d55a89ad8 --- /dev/null +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictIdentifierConverter.cs @@ -0,0 +1,17 @@ +using System; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.OpenIddict; + +public class AbpOpenIddictIdentifierConverter : ITransientDependency +{ + public virtual Guid FromString(string identifier) + { + return string.IsNullOrEmpty(identifier) ? default : Guid.Parse(identifier); + } + + public virtual string ToString(Guid identifier) + { + return identifier.ToString("D"); + } +} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictStoreBase.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictStoreBase.cs index 4c90c3a083..29254b8a00 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictStoreBase.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictStoreBase.cs @@ -20,26 +20,28 @@ public abstract class AbpOpenIddictStoreBase protected TRepository Repository { get; } protected IUnitOfWorkManager UnitOfWorkManager { get; } protected IGuidGenerator GuidGenerator { get; } + protected AbpOpenIddictIdentifierConverter IdentifierConverter { get; } - protected AbpOpenIddictStoreBase(TRepository repository, IUnitOfWorkManager unitOfWorkManager, IGuidGenerator guidGenerator) + protected AbpOpenIddictStoreBase(TRepository repository, IUnitOfWorkManager unitOfWorkManager, IGuidGenerator guidGenerator, AbpOpenIddictIdentifierConverter identifierConverter) { Repository = repository; UnitOfWorkManager = unitOfWorkManager; GuidGenerator = guidGenerator; + IdentifierConverter = identifierConverter; Logger = NullLogger>.Instance; } protected virtual Guid ConvertIdentifierFromString(string identifier) { - return string.IsNullOrEmpty(identifier) ? default : Guid.Parse(identifier); + return IdentifierConverter.FromString(identifier); } protected virtual string ConvertIdentifierToString(Guid identifier) { - return identifier.ToString("D"); + return IdentifierConverter.ToString(identifier); } - + protected virtual string WriteStream(Action action) { using (var stream = new MemoryStream()) diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpApplicationManager.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpApplicationManager.cs index b205f60be2..5b90574e59 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpApplicationManager.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpApplicationManager.cs @@ -11,14 +11,31 @@ namespace Volo.Abp.OpenIddict.Applications; public class AbpApplicationManager : OpenIddictApplicationManager, IAbpApplicationManager { + protected AbpOpenIddictIdentifierConverter IdentifierConverter { get; } + public AbpApplicationManager( [NotNull] IOpenIddictApplicationCache cache, [NotNull] ILogger logger, [NotNull] IOptionsMonitor options, - [NotNull] IOpenIddictApplicationStoreResolver resolver) + [NotNull] IOpenIddictApplicationStoreResolver resolver, + AbpOpenIddictIdentifierConverter identifierConverter) : base(cache, logger, options, resolver) { + IdentifierConverter = identifierConverter; + } + + public async override ValueTask UpdateAsync(OpenIddictApplicationModel application, CancellationToken cancellationToken = default) + { + if (!Options.CurrentValue.DisableEntityCaching) + { + var entity = await Store.FindByIdAsync(IdentifierConverter.ToString(application.Id), cancellationToken); + if (entity != null) + { + await Cache.RemoveAsync(entity, cancellationToken); + } + } + await base.UpdateAsync(application, cancellationToken); } public async override ValueTask PopulateAsync(OpenIddictApplicationDescriptor descriptor, OpenIddictApplicationModel application, CancellationToken cancellationToken = default) diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpOpenIddictApplicationCache.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpOpenIddictApplicationCache.cs index 2a1e49f4f7..877109e26c 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpOpenIddictApplicationCache.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpOpenIddictApplicationCache.cs @@ -34,13 +34,13 @@ public class AbpOpenIddictApplicationCache : AbpOpenIddictCacheBase FindByClientIdAsync(string identifier, CancellationToken cancellationToken) + public virtual async ValueTask FindByClientIdAsync(string clientId, CancellationToken cancellationToken) { - Check.NotNullOrEmpty(identifier, nameof(identifier)); + Check.NotNullOrEmpty(clientId, nameof(clientId)); - return await Cache.GetOrAddAsync($"{nameof(FindByClientIdAsync)}_{identifier}", async () => + return await Cache.GetOrAddAsync($"{nameof(FindByClientIdAsync)}_{clientId}", async () => { - var application = await Store.FindByClientIdAsync(identifier, cancellationToken); + var application = await Store.FindByClientIdAsync(clientId, cancellationToken); if (application != null) { await AddAsync(application, cancellationToken); @@ -49,13 +49,13 @@ public class AbpOpenIddictApplicationCache : AbpOpenIddictCacheBase FindByIdAsync(string identifier, CancellationToken cancellationToken) + public virtual async ValueTask FindByIdAsync(string id, CancellationToken cancellationToken) { - Check.NotNullOrEmpty(identifier, nameof(identifier)); + Check.NotNullOrEmpty(id, nameof(id)); - return await Cache.GetOrAddAsync($"{nameof(FindByIdAsync)}_{identifier}", async () => + return await Cache.GetOrAddAsync($"{nameof(FindByIdAsync)}_{id}", async () => { - var application = await Store.FindByIdAsync(identifier, cancellationToken); + var application = await Store.FindByIdAsync(id, cancellationToken); if (application != null) { await AddAsync(application, cancellationToken); diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpOpenIddictApplicationStore.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpOpenIddictApplicationStore.cs index 1f740ecfcd..480b8b52ee 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpOpenIddictApplicationStore.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpOpenIddictApplicationStore.cs @@ -22,8 +22,9 @@ public class AbpOpenIddictApplicationStore : AbpOpenIddictStoreBase +{ + protected AbpOpenIddictIdentifierConverter IdentifierConverter { get; } + + public AbpAuthorizationManager( + [NotNull] [ItemNotNull] IOpenIddictAuthorizationCache cache, + [NotNull] [ItemNotNull] ILogger> logger, + [NotNull] [ItemNotNull] IOptionsMonitor options, + [NotNull] IOpenIddictAuthorizationStoreResolver resolver, + AbpOpenIddictIdentifierConverter identifierConverter) + : base(cache, logger, options, resolver) + { + IdentifierConverter = identifierConverter; + } + + public async override ValueTask UpdateAsync(OpenIddictAuthorizationModel authorization, CancellationToken cancellationToken = default) + { + if (!Options.CurrentValue.DisableEntityCaching) + { + var entity = await Store.FindByIdAsync(IdentifierConverter.ToString(authorization.Id), cancellationToken); + if (entity != null) + { + await Cache.RemoveAsync(entity, cancellationToken); + } + } + + await base.UpdateAsync(authorization, cancellationToken); + } +} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpOpenIddictAuthorizationCache.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpOpenIddictAuthorizationCache.cs index 9079a57acc..95c1a59526 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpOpenIddictAuthorizationCache.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpOpenIddictAuthorizationCache.cs @@ -114,14 +114,14 @@ public class AbpOpenIddictAuthorizationCache : AbpOpenIddictCacheBase FindByApplicationIdAsync(string identifier, [EnumeratorCancellation] CancellationToken cancellationToken) + public async IAsyncEnumerable FindByApplicationIdAsync(string applicationId, [EnumeratorCancellation] CancellationToken cancellationToken) { - Check.NotNullOrEmpty(identifier, nameof(identifier)); + Check.NotNullOrEmpty(applicationId, nameof(applicationId)); - var authorizations = await ArrayCache.GetOrAddAsync($"{nameof(FindByApplicationIdAsync)}_{identifier}", async () => + var authorizations = await ArrayCache.GetOrAddAsync($"{nameof(FindByApplicationIdAsync)}_{applicationId}", async () => { var applications = new List(); - await foreach (var authorization in Store.FindByApplicationIdAsync(identifier, cancellationToken)) + await foreach (var authorization in Store.FindByApplicationIdAsync(applicationId, cancellationToken)) { applications.Add(authorization); await AddAsync(authorization, cancellationToken); @@ -135,12 +135,12 @@ public class AbpOpenIddictAuthorizationCache : AbpOpenIddictCacheBase FindByIdAsync(string identifier, CancellationToken cancellationToken) + public async ValueTask FindByIdAsync(string id, CancellationToken cancellationToken) { - Check.NotNullOrEmpty(identifier, nameof(identifier)); + Check.NotNullOrEmpty(id, nameof(id)); - return await Cache.GetOrAddAsync($"{nameof(FindByIdAsync)}_{identifier}", - async () => await Store.FindByIdAsync(identifier, cancellationToken), token: cancellationToken); + return await Cache.GetOrAddAsync($"{nameof(FindByIdAsync)}_{id}", + async () => await Store.FindByIdAsync(id, cancellationToken), token: cancellationToken); } public async IAsyncEnumerable FindBySubjectAsync(string subject, [EnumeratorCancellation] CancellationToken cancellationToken) diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpOpenIddictAuthorizationStore.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpOpenIddictAuthorizationStore.cs index 6e6582e047..1637288125 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpOpenIddictAuthorizationStore.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpOpenIddictAuthorizationStore.cs @@ -25,8 +25,9 @@ public class AbpOpenIddictAuthorizationStore : AbpOpenIddictStoreBase FindByIdAsync(string identifier, CancellationToken cancellationToken) + public virtual async ValueTask FindByIdAsync(string id, CancellationToken cancellationToken) { - Check.NotNullOrEmpty(identifier, nameof(identifier)); + Check.NotNullOrEmpty(id, nameof(id)); - return await Cache.GetOrAddAsync($"{nameof(FindByIdAsync)}_{identifier}", async () => + return await Cache.GetOrAddAsync($"{nameof(FindByIdAsync)}_{id}", async () => { - var scope = await Store.FindByIdAsync(identifier, cancellationToken); + var scope = await Store.FindByIdAsync(id, cancellationToken); if (scope != null) { await AddAsync(scope, cancellationToken); diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/AbpOpenIddictScopeStore.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/AbpOpenIddictScopeStore.cs index aedfe83c26..d10065e1dd 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/AbpOpenIddictScopeStore.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/AbpOpenIddictScopeStore.cs @@ -18,8 +18,9 @@ public class AbpOpenIddictScopeStore : AbpOpenIddictStoreBase +{ + protected AbpOpenIddictIdentifierConverter IdentifierConverter { get; } + + public AbpScopeManager( + [NotNull] [ItemNotNull] IOpenIddictScopeCache cache, + [NotNull] [ItemNotNull] ILogger> logger, + [NotNull] [ItemNotNull] IOptionsMonitor options, + [NotNull] IOpenIddictScopeStoreResolver resolver, + AbpOpenIddictIdentifierConverter identifierConverter) + : base(cache, logger, options, resolver) + { + IdentifierConverter = identifierConverter; + } + + public async override ValueTask UpdateAsync(OpenIddictScopeModel scope, CancellationToken cancellationToken = default) + { + if (!Options.CurrentValue.DisableEntityCaching) + { + var entity = await Store.FindByIdAsync(IdentifierConverter.ToString(scope.Id), cancellationToken); + if (entity != null) + { + await Cache.RemoveAsync(entity, cancellationToken); + } + } + + await base.UpdateAsync(scope, cancellationToken); + } +} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/AbpOpenIddictTokenStore.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/AbpOpenIddictTokenStore.cs index c8b80831a9..29b07d032d 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/AbpOpenIddictTokenStore.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/AbpOpenIddictTokenStore.cs @@ -25,8 +25,9 @@ public class AbpOpenIddictTokenStore : AbpOpenIddictStoreBase +{ + protected AbpOpenIddictIdentifierConverter IdentifierConverter { get; } + + public AbpTokenManager( + [NotNull] [ItemNotNull] IOpenIddictTokenCache cache, + [NotNull] [ItemNotNull] ILogger> logger, + [NotNull] [ItemNotNull] IOptionsMonitor options, + [NotNull] IOpenIddictTokenStoreResolver resolver, + AbpOpenIddictIdentifierConverter identifierConverter) + : base(cache, logger, options, resolver) + { + IdentifierConverter = identifierConverter; + } + + public async override ValueTask UpdateAsync(OpenIddictTokenModel token, CancellationToken cancellationToken = default) + { + if (!Options.CurrentValue.DisableEntityCaching) + { + var entity = await Store.FindByIdAsync(IdentifierConverter.ToString(token.Id), cancellationToken); + if (entity != null) + { + await Cache.RemoveAsync(entity, cancellationToken); + } + } + + await base.UpdateAsync(token, cancellationToken); + } +} From 8a9180af2788fa9220c1b9245a41cd7df1cb51de Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 2 Feb 2023 11:23:11 +0800 Subject: [PATCH 10/31] Validate `ExtensibleObject` when `MapExtraPropertiesTo`. Resolve #15549 --- .../ObjectExtending/ExtensibleObjectMapper.cs | 35 +++++++++++++------ ...opertiesObjectExtendingExtensions_Tests.cs | 31 +++++++++++++++- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ExtensibleObjectMapper.cs b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ExtensibleObjectMapper.cs index e667f7880d..2de527866b 100644 --- a/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ExtensibleObjectMapper.cs +++ b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ExtensibleObjectMapper.cs @@ -11,7 +11,7 @@ public static class ExtensibleObjectMapper /// /// Copies extra properties from the object /// to the object. - /// + /// /// Checks property definitions (over the ) /// based on the preference. /// @@ -34,14 +34,29 @@ public static class ExtensibleObjectMapper Check.NotNull(source, nameof(source)); Check.NotNull(destination, nameof(destination)); - ExtensibleObjectMapper.MapExtraPropertiesTo( - typeof(TSource), - typeof(TDestination), - source.ExtraProperties, - destination.ExtraProperties, - definitionChecks, - ignoredProperties - ); + var sourceType = typeof(TSource); + var destinationType = typeof(TDestination); + + Check.AssignableTo(sourceType, nameof(sourceType)); + Check.AssignableTo(destinationType, nameof(destinationType)); + Check.NotNull(source.ExtraProperties, nameof(source.ExtraProperties)); + Check.NotNull(destination.ExtraProperties, nameof(destination.ExtraProperties)); + + var sourceObjectExtension = ObjectExtensionManager.Instance.GetOrNull(sourceType); + var destinationObjectExtension = ObjectExtensionManager.Instance.GetOrNull(destinationType); + + foreach (var keyValue in source.ExtraProperties) + { + if (CanMapProperty( + keyValue.Key, + sourceObjectExtension, + destinationObjectExtension, + definitionChecks, + ignoredProperties)) + { + destination.SetProperty(keyValue.Key, keyValue.Value); + } + } } /// @@ -80,7 +95,7 @@ public static class ExtensibleObjectMapper /// /// Copies extra properties from the object /// to the object. - /// + /// /// Checks property definitions (over the ) /// based on the preference. /// diff --git a/framework/test/Volo.Abp.ObjectExtending.Tests/Volo/Abp/ObjectExtending/HasExtraPropertiesObjectExtendingExtensions_Tests.cs b/framework/test/Volo.Abp.ObjectExtending.Tests/Volo/Abp/ObjectExtending/HasExtraPropertiesObjectExtendingExtensions_Tests.cs index 5bf34515ef..bc31c60ac5 100644 --- a/framework/test/Volo.Abp.ObjectExtending.Tests/Volo/Abp/ObjectExtending/HasExtraPropertiesObjectExtendingExtensions_Tests.cs +++ b/framework/test/Volo.Abp.ObjectExtending.Tests/Volo/Abp/ObjectExtending/HasExtraPropertiesObjectExtendingExtensions_Tests.cs @@ -1,6 +1,10 @@ -using Shouldly; +using System.ComponentModel.DataAnnotations; +using System.Globalization; +using Shouldly; using Volo.Abp.Data; +using Volo.Abp.Localization; using Volo.Abp.ObjectExtending.TestObjects; +using Volo.Abp.Validation; using Xunit; namespace Volo.Abp.ObjectExtending; @@ -90,4 +94,29 @@ public class HasExtraPropertiesObjectExtendingExtensions_Tests : AbpObjectExtend _personDto.GetProperty("Sex").ShouldBe("male"); _personDto.GetProperty("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values } + + [Fact] + public void MapExtraPropertiesTo_Should_Validate_Properties() + { + using (CultureHelper.Use(CultureInfo.InvariantCulture)) + { + ObjectExtensionManager.Instance + .AddOrUpdateProperty( + "Name", + options => + { + options.Attributes.Add(new StringLengthAttribute(4)); + }); + + var person = new ExtensibleTestPerson().SetProperty("Name", "John"); + var personDto = new ExtensibleTestPersonDto(); + + person.MapExtraPropertiesTo(personDto); + + person.SetProperty("Name", "John Bush"); + Assert.Throws(() => person.MapExtraPropertiesTo(personDto)).ValidationErrors.ShouldContain(x => x.ErrorMessage == "The field Name must be a string with a maximum length of 4."); + } + + } + } From b2f05c8b32e2a017a2022b90ae68ab034b69f25a Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 2 Feb 2023 20:34:38 +0800 Subject: [PATCH 11/31] Set `EntityTenantId` of `EntityChange`. Resolve #15571 --- .../Volo/Abp/AuditLogging/EntityChange.cs | 1 + .../Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/EntityChange.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/EntityChange.cs index 05de8f7181..dd12102e4a 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/EntityChange.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/EntityChange.cs @@ -46,6 +46,7 @@ public class EntityChange : Entity, IMultiTenant, IHasExtraProperties TenantId = tenantId; ChangeTime = entityChangeInfo.ChangeTime; ChangeType = entityChangeInfo.ChangeType; + EntityTenantId = entityChangeInfo.EntityTenantId; EntityId = entityChangeInfo.EntityId.Truncate(EntityChangeConsts.MaxEntityTypeFullNameLength); EntityTypeFullName = entityChangeInfo.EntityTypeFullName.TruncateFromBeginning(EntityChangeConsts.MaxEntityTypeFullNameLength); diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs index 990b3d75a5..a97969d41c 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs @@ -71,5 +71,6 @@ public class MultiTenantAuditLog_Tests : AuditLogsTestBase auditLog.EntityChanges.Count.ShouldBe(2); auditLog.EntityChanges.ShouldContain(e => e.EntityId == entityId1.ToString()); auditLog.EntityChanges.ShouldContain(e => e.EntityId == entityId2.ToString()); + auditLog.EntityChanges.ShouldContain(e => e.EntityTenantId == tenantId); } } From af343a4c4c76460006d2002757df1ce4db70abc7 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Fri, 3 Feb 2023 18:57:44 +0300 Subject: [PATCH 12/31] Fix 3 test --- .../application-localization.service.spec.ts | 17 +++++++++++++++++ .../src/lib/tests/config-state.service.spec.ts | 17 +++++++++-------- .../core/src/lib/tests/date-utils.spec.ts | 2 +- .../src/lib/tests/localization-utils.spec.ts | 3 +++ .../src/lib/tests/localization.service.spec.ts | 9 +++++++++ .../core/src/lib/tests/permission.guard.spec.ts | 4 +++- 6 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 npm/ng-packs/packages/core/src/lib/tests/application-localization.service.spec.ts diff --git a/npm/ng-packs/packages/core/src/lib/tests/application-localization.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/application-localization.service.spec.ts new file mode 100644 index 0000000000..4e81b39f59 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/application-localization.service.spec.ts @@ -0,0 +1,17 @@ +export const APPLICATION_LOCALIZATION_DATA = { + resources: { + Default: { texts: {}, baseResources: [] }, + MyProjectName: { + texts: { + "'{0}' and '{1}' do not match.": "'{0}' and '{1}' do not match.", + }, + baseResources: [], + }, + AbpIdentity: { + texts: { + Identity: 'identity', + }, + baseResources: [], + }, + }, +}; diff --git a/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts index 3dc1b45732..58040e8652 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts @@ -8,6 +8,9 @@ import { } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models'; import { ConfigStateService } from '../services'; import { CORE_OPTIONS } from '../tokens'; +import { IncludeLocalizationResourcesProvider } from '../providers'; +import { APPLICATION_LOCALIZATION_DATA } from './application-localization.service.spec'; +import { AbpApplicationLocalizationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-localization.service'; export const CONFIG_STATE_DATA = { environment: { @@ -34,14 +37,7 @@ export const CONFIG_STATE_DATA = { layouts: [null, null, null], }, localization: { - values: { - MyProjectName: { - "'{0}' and '{1}' do not match.": "'{0}' and '{1}' do not match.", - }, - AbpIdentity: { - Identity: 'identity', - }, - }, + values: {}, languages: [ { cultureName: 'cs', @@ -115,6 +111,11 @@ describe('ConfigStateService', () => { provide: AbpApplicationConfigurationService, useValue: { get: () => of(CONFIG_STATE_DATA) }, }, + { + provide: AbpApplicationLocalizationService, + useValue: { get: () => APPLICATION_LOCALIZATION_DATA }, + }, + IncludeLocalizationResourcesProvider, ], }); diff --git a/npm/ng-packs/packages/core/src/lib/tests/date-utils.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/date-utils.spec.ts index 20ef2e4a48..33f02dfb4f 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/date-utils.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/date-utils.spec.ts @@ -15,7 +15,7 @@ describe('Date Utils', () => { let config: ConfigStateService; beforeEach(() => { - config = new ConfigStateService(null); + config = new ConfigStateService(null, null, null); }); describe('#getShortDateFormat', () => { diff --git a/npm/ng-packs/packages/core/src/lib/tests/localization-utils.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/localization-utils.spec.ts index c12b7b61ce..4af0755d6c 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/localization-utils.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/localization-utils.spec.ts @@ -57,6 +57,7 @@ describe('Localization Utils', () => { languages: [], languageFilesMap: null, languagesMap: null, + resources: {}, }); test.each` @@ -100,6 +101,7 @@ describe('Localization Utils', () => { languages: [], languageFilesMap: null, languagesMap: null, + resources: {}, }); test.each` @@ -148,6 +150,7 @@ describe('Localization Utils', () => { languages: [], languageFilesMap: null, languagesMap: null, + resources: {}, }); test.each` diff --git a/npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts index 5aedd28f6e..d2eb653a85 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts @@ -8,8 +8,12 @@ import { SessionStateService } from '../services/session-state.service'; import { LocalizationService } from '../services/localization.service'; import { CORE_OPTIONS } from '../tokens/options.token'; import { CONFIG_STATE_DATA } from './config-state.service.spec'; +import { AbpApplicationLocalizationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-localization.service'; +import { APPLICATION_LOCALIZATION_DATA } from './application-localization.service.spec'; +import { IncludeLocalizationResourcesProvider } from '../providers'; const appConfigData$ = new BehaviorSubject(CONFIG_STATE_DATA); +const appLocalizationData$ = new BehaviorSubject(APPLICATION_LOCALIZATION_DATA); describe('LocalizationService', () => { let spectator: SpectatorService; @@ -22,6 +26,7 @@ describe('LocalizationService', () => { entryComponents: [], mocks: [Router], providers: [ + IncludeLocalizationResourcesProvider, { provide: CORE_OPTIONS, useValue: { registerLocaleFn: () => Promise.resolve(), cultureNameLocaleFileMap: {} }, @@ -30,6 +35,10 @@ describe('LocalizationService', () => { provide: AbpApplicationConfigurationService, useValue: { get: () => appConfigData$ }, }, + { + provide: AbpApplicationLocalizationService, + useValue: { get: () => appLocalizationData$ }, + }, ], }); diff --git a/npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts index 4369b8434f..372f3434f3 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts @@ -9,6 +9,7 @@ import { HttpErrorReporterService } from '../services/http-error-reporter.servic import { PermissionService } from '../services/permission.service'; import { RoutesService } from '../services/routes.service'; import { CORE_OPTIONS } from '../tokens/options.token'; +import { IncludeLocalizationResourcesProvider } from '../providers'; describe('PermissionGuard', () => { let spectator: SpectatorService; @@ -36,7 +37,7 @@ describe('PermissionGuard', () => { }, }, ], - { relativeLinkResolution: 'legacy' }, + {}, ), ], providers: [ @@ -45,6 +46,7 @@ describe('PermissionGuard', () => { useValue: '/', }, { provide: CORE_OPTIONS, useValue: { skipGetAppConfiguration: true } }, + IncludeLocalizationResourcesProvider, ], }); From 800928d6348931b0414a6f47f0d8a9ebeb983b64 Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Sun, 5 Feb 2023 08:38:26 +0000 Subject: [PATCH 13/31] Update EntityNotFoundException.cs --- .../Volo/Abp/Domain/Entities/EntityNotFoundException.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/Domain/Entities/EntityNotFoundException.cs b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/Domain/Entities/EntityNotFoundException.cs index d5a143d736..1feb8c4cbb 100644 --- a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/Domain/Entities/EntityNotFoundException.cs +++ b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/Domain/Entities/EntityNotFoundException.cs @@ -3,7 +3,7 @@ namespace Volo.Abp.Domain.Entities; /// -/// This exception is thrown if an entity excepted to be found but not found. +/// This exception is thrown if an entity is expected to be found but not found. /// public class EntityNotFoundException : AbpException { From 8d1b1b62b9b35dfeb0e5422caa30f6f39d56ab6e Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 6 Feb 2023 14:37:25 +0300 Subject: [PATCH 14/31] Change VALIDATION_TARGET_SELECTOR --- npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts index d73fa50f4e..e04ed6dde1 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts @@ -78,7 +78,7 @@ export class ThemeBasicModule { }, { provide: VALIDATION_TARGET_SELECTOR, - useValue: '*:has(> .form-control)', + useValue: '.form-group', }, { provide: VALIDATION_INVALID_CLASSES, From 756f52e548d0c45c999c544fc4c44f99a577520c Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 6 Feb 2023 15:14:36 +0300 Subject: [PATCH 15/31] Comment-out AbpOAuthModule import --- npm/ng-packs/apps/dev-app/src/app/app.module.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/apps/dev-app/src/app/app.module.ts b/npm/ng-packs/apps/dev-app/src/app/app.module.ts index c3a0cd68c5..52ebd38362 100644 --- a/npm/ng-packs/apps/dev-app/src/app/app.module.ts +++ b/npm/ng-packs/apps/dev-app/src/app/app.module.ts @@ -14,7 +14,7 @@ import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { APP_ROUTE_PROVIDER } from './route.provider'; import { FeatureManagementModule } from '@abp/ng.feature-management'; -// import { AbpOAuthModule } from '@abp/ng.oauth'; +import { AbpOAuthModule } from '@abp/ng.oauth'; @NgModule({ imports: [ @@ -27,7 +27,7 @@ import { FeatureManagementModule } from '@abp/ng.feature-management'; sendNullsAsQueryParam: false, skipGetAppConfiguration: false, }), - // AbpOAuthModule.forRoot(), + AbpOAuthModule.forRoot(), ThemeSharedModule.forRoot(), AccountConfigModule.forRoot(), IdentityConfigModule.forRoot(), From 3ac8e34df945fdc37d3a501bbeb57e6ac19bfaac Mon Sep 17 00:00:00 2001 From: muhammedaltug Date: Mon, 6 Feb 2023 16:28:47 +0300 Subject: [PATCH 16/31] wrap defaultValue with quotes when type is string --- npm/ng-packs/packages/schematics/src/models/model.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/schematics/src/models/model.ts b/npm/ng-packs/packages/schematics/src/models/model.ts index 048c08a1b0..142d4da75c 100644 --- a/npm/ng-packs/packages/schematics/src/models/model.ts +++ b/npm/ng-packs/packages/schematics/src/models/model.ts @@ -45,9 +45,13 @@ abstract class TypeRef { get default() { return this._default; } - set default(value: string) { + set default(value: any) { if (!value) return; - this._default = ` = ${value}`; + if (typeof value === 'string') { + this._default = ` = "${value}"`; + } else { + this._default = ` = ${value}`; + } } constructor(options: TypeRefOptions) { From d04d0c4d2f3f3a437c6a9d85efab590347014b03 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 7 Feb 2023 09:55:54 +0300 Subject: [PATCH 17/31] Move Is_External logic to OAuth pack --- .../src/lib/interceptors/api.interceptor.ts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/npm/ng-packs/packages/oauth/src/lib/interceptors/api.interceptor.ts b/npm/ng-packs/packages/oauth/src/lib/interceptors/api.interceptor.ts index e807133c0d..f36f966559 100644 --- a/npm/ng-packs/packages/oauth/src/lib/interceptors/api.interceptor.ts +++ b/npm/ng-packs/packages/oauth/src/lib/interceptors/api.interceptor.ts @@ -2,7 +2,13 @@ import { HttpHandler, HttpHeaders, HttpRequest } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { OAuthService } from 'angular-oauth2-oidc'; import { finalize } from 'rxjs/operators'; -import { SessionStateService, HttpWaitService, TENANT_KEY, IApiInterceptor } from '@abp/ng.core'; +import { + SessionStateService, + HttpWaitService, + TENANT_KEY, + IApiInterceptor, + IS_EXTERNAL_REQUEST, +} from '@abp/ng.core'; @Injectable({ providedIn: 'root', @@ -17,12 +23,15 @@ export class OAuthApiInterceptor implements IApiInterceptor { intercept(request: HttpRequest, next: HttpHandler) { this.httpWaitService.addRequest(request); - return next - .handle( - request.clone({ + const isExternalRequest = request.context?.get(IS_EXTERNAL_REQUEST); + const newRequest = isExternalRequest + ? request + : request.clone({ setHeaders: this.getAdditionalHeaders(request.headers), - }), - ) + }); + + return next + .handle(newRequest) .pipe(finalize(() => this.httpWaitService.deleteRequest(request))); } From 1bfed34f9483c0e4d8ef4363d1f2e6ef558e8864 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 7 Feb 2023 10:25:39 +0300 Subject: [PATCH 18/31] Change auto-pr for 7.1 --- .github/workflows/auto-pr.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-pr.yml b/.github/workflows/auto-pr.yml index 1a7b797ef8..083ccc554c 100644 --- a/.github/workflows/auto-pr.yml +++ b/.github/workflows/auto-pr.yml @@ -1,4 +1,4 @@ -name: Merge branch dev with rel-7.0 +name: Merge branch rel-7.1 with rel-7.0 on: push: branches: @@ -7,7 +7,7 @@ permissions: contents: read jobs: - merge-dev-with-rel-6-0: + merge-rel-7-1-with-rel-7-0: permissions: contents: write # for peter-evans/create-pull-request to create branch pull-requests: write # for peter-evans/create-pull-request to create a PR @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - ref: dev + ref: rel-7.1 - name: Reset promotion branch run: | git fetch origin rel-7.0:rel-7.0 @@ -24,7 +24,7 @@ jobs: uses: peter-evans/create-pull-request@v3 with: branch: auto-merge/rel-7-0/${{github.run_number}} - title: Merge branch dev with rel-7.0 - body: This PR generated automatically to merge dev with rel-7.0. Please review the changed files before merging to prevent any errors that may occur. + title: Merge branch rel-7.1 with rel-7.0 + body: This PR generated automatically to merge rel-7.1 with rel-7.0. Please review the changed files before merging to prevent any errors that may occur. reviewers: ${{github.actor}} token: ${{ github.token }} From 064add67a75082bad0df3829f3d2c5bcda0a58d1 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 7 Feb 2023 14:48:53 +0300 Subject: [PATCH 19/31] Cli: Include company name in app.module.ts when adding angular source code --- .../Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs index 74a45ba7e1..b84cdae2c6 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs @@ -267,7 +267,7 @@ public class AngularSourceCodeAdder : ITransientDependency var fileContent = File.ReadAllText(filePath); - fileContent = "import { "+moduleName.Split(".").Last()+"ConfigModule } from '@"+moduleName.Split(".").Last().ToKebabCase()+"/config';" + Environment.NewLine + fileContent; + fileContent = "import { "+moduleName.Split(".").Last()+"ConfigModule } from '@"+moduleName.Replace(".", "/") .ToKebabCase()+"/config';" + Environment.NewLine + fileContent; fileContent = Regex.Replace(fileContent, "imports\\s*:\\s*\\[", "imports: ["+ Environment.NewLine + From 97204dfa2772c227d6d9dcc28ffe9f85f2181ada Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 7 Feb 2023 18:00:19 +0300 Subject: [PATCH 20/31] Update AngularSourceCodeAdder.cs --- .../Cli/ProjectModification/AngularSourceCodeAdder.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs index b84cdae2c6..e1798346d2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs @@ -267,7 +267,15 @@ public class AngularSourceCodeAdder : ITransientDependency var fileContent = File.ReadAllText(filePath); - fileContent = "import { "+moduleName.Split(".").Last()+"ConfigModule } from '@"+moduleName.Replace(".", "/") .ToKebabCase()+"/config';" + Environment.NewLine + fileContent; + var moduleNameAsConfigPath = moduleName; + + if (moduleName.Contains(".")) + { + var moduleNameSplited = moduleName.Split("."); + moduleNameAsConfigPath = moduleNameSplited.Take(moduleNameSplited.Length-1).JoinAsString(".") + "/" + moduleNameSplited.Last(); + } + + fileContent = "import { "+moduleName.Split(".").Last()+"ConfigModule } from '@"+moduleNameAsConfigPath.ToKebabCase()+"/config';" + Environment.NewLine + fileContent; fileContent = Regex.Replace(fileContent, "imports\\s*:\\s*\\[", "imports: ["+ Environment.NewLine + From 2869ad526837c99ff3fd460a78453af97a918a77 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 7 Feb 2023 18:06:09 +0300 Subject: [PATCH 21/31] Update AngularSourceCodeAdder.cs --- .../Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs index e1798346d2..4adffb6745 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs @@ -267,15 +267,15 @@ public class AngularSourceCodeAdder : ITransientDependency var fileContent = File.ReadAllText(filePath); - var moduleNameAsConfigPath = moduleName; + var moduleNameAsConfigPath = moduleName.ToKebabCase(); if (moduleName.Contains(".")) { var moduleNameSplited = moduleName.Split("."); - moduleNameAsConfigPath = moduleNameSplited.Take(moduleNameSplited.Length-1).JoinAsString(".") + "/" + moduleNameSplited.Last(); + moduleNameAsConfigPath = moduleNameSplited.Take(moduleNameSplited.Length-1).JoinAsString(".").ToKebabCase() + "/" + moduleNameSplited.Last().ToKebabCase(); } - fileContent = "import { "+moduleName.Split(".").Last()+"ConfigModule } from '@"+moduleNameAsConfigPath.ToKebabCase()+"/config';" + Environment.NewLine + fileContent; + fileContent = "import { "+moduleName.Split(".").Last()+"ConfigModule } from '@"+moduleNameAsConfigPath+"/config';" + Environment.NewLine + fileContent; fileContent = Regex.Replace(fileContent, "imports\\s*:\\s*\\[", "imports: ["+ Environment.NewLine + From 6f342e726e1a005a1860b51ff8c755255f449ca9 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 8 Feb 2023 14:31:22 +0800 Subject: [PATCH 22/31] Update LeptonXLite package version --- .../MyCompanyName.MyProjectName.Blazor.Server.Mongo.csproj | 4 ++-- .../MyCompanyName.MyProjectName.Blazor.Server.csproj | 4 ++-- .../MyCompanyName.MyProjectName.Host.Mongo.csproj | 2 +- .../MyCompanyName.MyProjectName.Host.csproj | 2 +- .../MyCompanyName.MyProjectName.Mvc.Mongo.csproj | 2 +- .../MyCompanyName.MyProjectName.Mvc.csproj | 2 +- .../MyCompanyName.MyProjectName.AuthServer.csproj | 2 +- .../MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj | 4 ++-- .../MyCompanyName.MyProjectName.Blazor.Server.csproj | 4 ++-- .../MyCompanyName.MyProjectName.Blazor.csproj | 2 +- .../MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj | 2 +- .../MyCompanyName.MyProjectName.Web.Host.csproj | 2 +- .../MyCompanyName.MyProjectName.Web.csproj | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyCompanyName.MyProjectName.Blazor.Server.Mongo.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyCompanyName.MyProjectName.Blazor.Server.Mongo.csproj index 0983f7740c..60d0fd9252 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyCompanyName.MyProjectName.Blazor.Server.Mongo.csproj +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyCompanyName.MyProjectName.Blazor.Server.Mongo.csproj @@ -21,8 +21,8 @@ - - + + diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj index 50d90dcc3e..67b96e0b72 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj @@ -21,8 +21,8 @@ - - + + diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj index 60712105a2..1d24418c23 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj @@ -69,7 +69,7 @@ - + diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj index 24eb4368de..693c73691b 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj @@ -70,7 +70,7 @@ - + diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj index 5f99ac74ae..98f822e53b 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj @@ -17,7 +17,7 @@ - + diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj index 06cec0688c..996e05eca2 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj @@ -17,7 +17,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj index 21fb37e73e..f033af0cde 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj @@ -43,7 +43,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj index 832bd8d7ba..0ba0a2718b 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj @@ -29,8 +29,8 @@ - - + + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj index eb34741aa4..a7d61d429e 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj @@ -27,8 +27,8 @@ - - + + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj index 53338ee686..1c205cfec0 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj @@ -23,7 +23,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj index 6e72b6879f..612eb08f9c 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj @@ -25,7 +25,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj index fe7c773451..100ba3ffa5 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj @@ -27,7 +27,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj index 560ba570dd..809fecad53 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj @@ -41,7 +41,7 @@ - + From 7e75a73ddec9123099e006949585b3ef0e24ae57 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 9 Feb 2023 10:37:21 +0800 Subject: [PATCH 23/31] Introduce `ApplicationConfigurationChangedService`. --- .../ApplicationConfigurationChangedService.cs | 15 ++++++++++++++ ...blyCachedApplicationConfigurationClient.cs | 20 +++++++++++++++---- .../Themes/Basic/NavMenu.razor.cs | 18 +++++++++-------- .../Themes/Basic/NavToolbar.razor.cs | 11 +++++----- .../Pages/Authentication.razor | 15 ++++++++++++-- .../Themes/Basic/LoginDisplay.razor.cs | 13 ++++++------ 6 files changed, 66 insertions(+), 26 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/ApplicationConfigurationChangedService.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/ApplicationConfigurationChangedService.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/ApplicationConfigurationChangedService.cs new file mode 100644 index 0000000000..9803a7991d --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/ApplicationConfigurationChangedService.cs @@ -0,0 +1,15 @@ +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.AspNetCore.Components.Web.Security; + +public delegate void ApplicationConfigurationChangedHandler(); + +public class ApplicationConfigurationChangedService : IScopedDependency +{ + public event ApplicationConfigurationChangedHandler Changed; + + public void NotifyChanged() + { + Changed?.Invoke(); + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs index c3ba260a88..79a2dacd9a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs @@ -1,4 +1,6 @@ using System.Threading.Tasks; +using Microsoft.AspNetCore.Components.Authorization; +using Volo.Abp.AspNetCore.Components.Web.Security; using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies; using Volo.Abp.AspNetCore.Mvc.Client; @@ -10,23 +12,31 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly; public class WebAssemblyCachedApplicationConfigurationClient : ICachedApplicationConfigurationClient, ITransientDependency { protected AbpApplicationConfigurationClientProxy ApplicationConfigurationClientProxy { get; } - + protected AbpApplicationLocalizationClientProxy ApplicationLocalizationClientProxy { get; } protected ApplicationConfigurationCache Cache { get; } protected ICurrentTenantAccessor CurrentTenantAccessor { get; } + protected ApplicationConfigurationChangedService ApplicationConfigurationChangedService { get; } + + protected AuthenticationStateProvider AuthenticationStateProvider { get; } + public WebAssemblyCachedApplicationConfigurationClient( AbpApplicationConfigurationClientProxy applicationConfigurationClientProxy, ApplicationConfigurationCache cache, - ICurrentTenantAccessor currentTenantAccessor, - AbpApplicationLocalizationClientProxy applicationLocalizationClientProxy) + ICurrentTenantAccessor currentTenantAccessor, + AbpApplicationLocalizationClientProxy applicationLocalizationClientProxy, + ApplicationConfigurationChangedService applicationConfigurationChangedService, + AuthenticationStateProvider authenticationStateProvider) { ApplicationConfigurationClientProxy = applicationConfigurationClientProxy; Cache = cache; CurrentTenantAccessor = currentTenantAccessor; ApplicationLocalizationClientProxy = applicationLocalizationClientProxy; + ApplicationConfigurationChangedService = applicationConfigurationChangedService; + AuthenticationStateProvider = authenticationStateProvider; } public virtual async Task InitializeAsync() @@ -45,9 +55,11 @@ public class WebAssemblyCachedApplicationConfigurationClient : ICachedApplicatio ); configurationDto.Localization.Resources = localizationDto.Resources; - + Cache.Set(configurationDto); + ApplicationConfigurationChangedService.NotifyChanged(); + CurrentTenantAccessor.Current = new BasicTenantInfo( configurationDto.CurrentTenant.Id, configurationDto.CurrentTenant.Name diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/NavMenu.razor.cs b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/NavMenu.razor.cs index fb117369eb..5b9c07ad44 100644 --- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/NavMenu.razor.cs +++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/NavMenu.razor.cs @@ -1,7 +1,9 @@ using System; +using System.Text.Json; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; +using Volo.Abp.AspNetCore.Components.Web.Security; using Volo.Abp.UI.Navigation; namespace Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic; @@ -12,24 +14,24 @@ public partial class NavMenu : IDisposable protected IMenuManager MenuManager { get; set; } [Inject] - protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } + protected ApplicationConfigurationChangedService ApplicationConfigurationChangedService { get; set; } protected ApplicationMenu Menu { get; set; } - protected override async Task OnInitializedAsync() + protected async override Task OnInitializedAsync() { Menu = await MenuManager.GetMainMenuAsync(); - AuthenticationStateProvider.AuthenticationStateChanged += AuthenticationStateProviderOnAuthenticationStateChanged; + ApplicationConfigurationChangedService.Changed += ApplicationConfigurationChanged; } - public void Dispose() + private async void ApplicationConfigurationChanged() { - AuthenticationStateProvider.AuthenticationStateChanged -= AuthenticationStateProviderOnAuthenticationStateChanged; + Menu = await MenuManager.GetMainMenuAsync(); + await InvokeAsync(StateHasChanged); } - private async void AuthenticationStateProviderOnAuthenticationStateChanged(Task task) + public void Dispose() { - Menu = await MenuManager.GetMainMenuAsync(); - await InvokeAsync(StateHasChanged); + ApplicationConfigurationChangedService.Changed -= ApplicationConfigurationChanged; } } diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/NavToolbar.razor.cs b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/NavToolbar.razor.cs index 8e1040ae89..9a0d76afa2 100644 --- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/NavToolbar.razor.cs +++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/NavToolbar.razor.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using JetBrains.Annotations; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; +using Volo.Abp.AspNetCore.Components.Web.Security; using Volo.Abp.AspNetCore.Components.Web.Theming.Toolbars; namespace Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic; @@ -14,14 +15,14 @@ public partial class NavToolbar : IDisposable private IToolbarManager ToolbarManager { get; set; } [Inject] - private AuthenticationStateProvider AuthenticationStateProvider { get; set; } + protected ApplicationConfigurationChangedService ApplicationConfigurationChangedService { get; set; } private List ToolbarItemRenders { get; set; } = new List(); - protected override async Task OnInitializedAsync() + protected async override Task OnInitializedAsync() { await GetToolbarItemRendersAsync(); - AuthenticationStateProvider.AuthenticationStateChanged += AuthenticationStateProviderOnAuthenticationStateChanged; + ApplicationConfigurationChangedService.Changed += ApplicationConfigurationChanged; } private async Task GetToolbarItemRendersAsync() @@ -41,7 +42,7 @@ public partial class NavToolbar : IDisposable } } - private async void AuthenticationStateProviderOnAuthenticationStateChanged(Task task) + private async void ApplicationConfigurationChanged() { await GetToolbarItemRendersAsync(); await InvokeAsync(StateHasChanged); @@ -49,6 +50,6 @@ public partial class NavToolbar : IDisposable public void Dispose() { - AuthenticationStateProvider.AuthenticationStateChanged -= AuthenticationStateProviderOnAuthenticationStateChanged; + ApplicationConfigurationChangedService.Changed -= ApplicationConfigurationChanged; } } diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Pages/Authentication.razor b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Pages/Authentication.razor index e237cea555..1b9fe309a2 100644 --- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Pages/Authentication.razor +++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Pages/Authentication.razor @@ -1,7 +1,18 @@ @page "/authentication/{action}" @using Microsoft.AspNetCore.Components.WebAssembly.Authentication - - +@using Volo.Abp.AspNetCore.Components.Web.Security + +@inject WebAssemblyCachedApplicationConfigurationClient WebAssemblyCachedApplicationConfigurationClient @code{ [Parameter] public string Action { get; set; } + + private async Task OnLogInSucceeded(RemoteAuthenticationState state) + { + await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync(); + } + + private async Task OnLogOutSucceeded(RemoteAuthenticationState state) + { + await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync(); + } } diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs index 92577ff937..4312369b2b 100644 --- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs +++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Routing; using Microsoft.AspNetCore.Components.WebAssembly.Authentication; using Microsoft.JSInterop; +using Volo.Abp.AspNetCore.Components.Web.Security; using Volo.Abp.UI.Navigation; namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Themes.Basic; @@ -16,18 +17,17 @@ public partial class LoginDisplay : IDisposable protected IMenuManager MenuManager { get; set; } [Inject] - public AuthenticationStateProvider AuthenticationStateProvider { get; set; } + protected ApplicationConfigurationChangedService ApplicationConfigurationChangedService { get; set; } protected ApplicationMenu Menu { get; set; } - protected override async Task OnInitializedAsync() + protected async override Task OnInitializedAsync() { Menu = await MenuManager.GetAsync(StandardMenus.User); Navigation.LocationChanged += OnLocationChanged; - AuthenticationStateProvider.AuthenticationStateChanged += - AuthenticationStateProviderOnAuthenticationStateChanged; + ApplicationConfigurationChangedService.Changed += ApplicationConfigurationChanged; } protected virtual void OnLocationChanged(object sender, LocationChangedEventArgs e) @@ -35,7 +35,7 @@ public partial class LoginDisplay : IDisposable InvokeAsync(StateHasChanged); } - private async void AuthenticationStateProviderOnAuthenticationStateChanged(Task task) + private async void ApplicationConfigurationChanged() { Menu = await MenuManager.GetAsync(StandardMenus.User); await InvokeAsync(StateHasChanged); @@ -44,8 +44,7 @@ public partial class LoginDisplay : IDisposable public void Dispose() { Navigation.LocationChanged -= OnLocationChanged; - AuthenticationStateProvider.AuthenticationStateChanged -= - AuthenticationStateProviderOnAuthenticationStateChanged; + ApplicationConfigurationChangedService.Changed -= ApplicationConfigurationChanged; } private async Task NavigateToAsync(string uri, string target = null) From 464e5a49c6547548b7ff043a9cb8e4603d098050 Mon Sep 17 00:00:00 2001 From: braim23 <94292623+braim23@users.noreply.github.com> Date: Thu, 9 Feb 2023 15:44:32 +0300 Subject: [PATCH 24/31] Embedded YouTube videos to the Single Layer TodoApp Doc --- docs/en/Tutorials/Todo/Single-Layer/Index.md | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/en/Tutorials/Todo/Single-Layer/Index.md b/docs/en/Tutorials/Todo/Single-Layer/Index.md index b257ebbe01..7dad7f0bd4 100644 --- a/docs/en/Tutorials/Todo/Single-Layer/Index.md +++ b/docs/en/Tutorials/Todo/Single-Layer/Index.md @@ -14,6 +14,32 @@ This is a single-part quick-start tutorial to build a simple todo application wi You can find the source code of the completed application [here](https://github.com/abpframework/abp-samples/tree/master/TodoApp-SingleLayer). +{{if UI=="MVC" && DB =="EF"}} + + + +{{else if UI=="BlazorServer" && DB=="EF"}} + + + +{{else if UI=="NG" && DB=="EF"}} + + + +{{else if UI=="MVC" && DB=="Mongo"}} + + + +{{else if UI=="BlazorServer" && DB=="Mongo"}} + + + +{{else if UI=="NG" && DB=="Mongo"}} + + + +{{end}} + ## Pre-Requirements * An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 6.0+](https://dotnet.microsoft.com/download/dotnet) development. From e9ac721f9897b901cbbdf856bbc3128d28cbc7a4 Mon Sep 17 00:00:00 2001 From: Hamza Albreem <94292623+braim23@users.noreply.github.com> Date: Thu, 9 Feb 2023 16:15:56 +0300 Subject: [PATCH 25/31] Update Index.md --- docs/en/Tutorials/Todo/Single-Layer/Index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/en/Tutorials/Todo/Single-Layer/Index.md b/docs/en/Tutorials/Todo/Single-Layer/Index.md index 7dad7f0bd4..ce73289605 100644 --- a/docs/en/Tutorials/Todo/Single-Layer/Index.md +++ b/docs/en/Tutorials/Todo/Single-Layer/Index.md @@ -14,6 +14,7 @@ This is a single-part quick-start tutorial to build a simple todo application wi You can find the source code of the completed application [here](https://github.com/abpframework/abp-samples/tree/master/TodoApp-SingleLayer). +This documentation has a video tutorial on **YouTube**!! You can watch it here: {{if UI=="MVC" && DB =="EF"}} From 26b9fbc119c34f8087e5ad043166a001eabc62f6 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Wed, 15 Feb 2023 18:44:24 +0300 Subject: [PATCH 26/31] remove unnescessary abstraction --- .../packages/core/src/lib/models/auth.ts | 6 +++-- .../set-token-response-to-storage.token.ts | 3 +++ .../packages/oauth/src/lib/oauth.module.ts | 11 +++----- .../oauth/src/lib/utils/auth-utils.ts | 25 +------------------ 4 files changed, 11 insertions(+), 34 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/models/auth.ts b/npm/ng-packs/packages/core/src/lib/models/auth.ts index 9c0250d316..dcaf6e7f11 100644 --- a/npm/ng-packs/packages/core/src/lib/models/auth.ts +++ b/npm/ng-packs/packages/core/src/lib/models/auth.ts @@ -12,6 +12,8 @@ export type PipeToLoginFn = ( params: Pick, injector: Injector, ) => UnaryFunction; - -export type SetTokenResponseToStorageFn = (injector: Injector, tokenRes: T) => void; +/** + * @deprecated The interface should not be used anymore. + */ +export type SetTokenResponseToStorageFn = (tokenRes: T) => void; export type CheckAuthenticationStateFn = (injector: Injector) => void; diff --git a/npm/ng-packs/packages/core/src/lib/tokens/set-token-response-to-storage.token.ts b/npm/ng-packs/packages/core/src/lib/tokens/set-token-response-to-storage.token.ts index 0436195654..0cd26708bf 100644 --- a/npm/ng-packs/packages/core/src/lib/tokens/set-token-response-to-storage.token.ts +++ b/npm/ng-packs/packages/core/src/lib/tokens/set-token-response-to-storage.token.ts @@ -1,6 +1,9 @@ import { InjectionToken } from '@angular/core'; import { SetTokenResponseToStorageFn } from '../models'; +/** + * @deprecated The token should not be used anymore. + */ export const SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY = new InjectionToken( 'SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY', ); diff --git a/npm/ng-packs/packages/oauth/src/lib/oauth.module.ts b/npm/ng-packs/packages/oauth/src/lib/oauth.module.ts index 753ad815e3..7c8c2af99c 100644 --- a/npm/ng-packs/packages/oauth/src/lib/oauth.module.ts +++ b/npm/ng-packs/packages/oauth/src/lib/oauth.module.ts @@ -1,4 +1,4 @@ -import { APP_INITIALIZER, Injector, ModuleWithProviders, NgModule } from '@angular/core'; +import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { OAuthModule, OAuthStorage } from 'angular-oauth2-oidc'; import { @@ -7,8 +7,7 @@ import { AuthService, CHECK_AUTHENTICATION_STATE_FN_KEY, noop, - PIPE_TO_LOGIN_FN_KEY, - SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY, + PIPE_TO_LOGIN_FN_KEY } from '@abp/ng.core'; import { storageFactory } from './utils/storage.factory'; import { AbpOAuthService } from './services'; @@ -17,7 +16,7 @@ import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { OAuthApiInterceptor } from './interceptors/api.interceptor'; import { AbpOAuthGuard } from './guards/oauth.guard'; import { NavigateToManageProfileProvider } from './providers'; -import { checkAccessToken, pipeToLogin, setTokenResponseToStorage } from './utils'; +import { checkAccessToken, pipeToLogin } from './utils'; @NgModule({ imports: [CommonModule, OAuthModule], @@ -43,10 +42,6 @@ export class AbpOAuthModule { provide: PIPE_TO_LOGIN_FN_KEY, useValue: pipeToLogin, }, - { - provide: SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY, - useValue: setTokenResponseToStorage, - }, { provide: CHECK_AUTHENTICATION_STATE_FN_KEY, useValue: checkAccessToken, diff --git a/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts b/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts index 74df5ce79b..64dcd76576 100644 --- a/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts +++ b/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts @@ -1,4 +1,4 @@ -import { Injector } from '@angular/core'; +import { inject, Injector } from '@angular/core'; import { Router } from '@angular/router'; import { OAuthStorage, TokenResponse } from 'angular-oauth2-oidc'; import { pipe } from 'rxjs'; @@ -29,29 +29,6 @@ export const pipeToLogin: PipeToLoginFn = function ( ); }; -export const setTokenResponseToStorage: SetTokenResponseToStorageFn = function ( - injector: Injector, - tokenRes: TokenResponse, -) { - const { access_token, refresh_token, scope: grantedScopes, expires_in } = tokenRes; - const storage = injector.get(OAuthStorage); - - storage.setItem('access_token', access_token); - storage.setItem('refresh_token', refresh_token); - storage.setItem('access_token_stored_at', '' + Date.now()); - - if (grantedScopes) { - storage.setItem('granted_scopes', JSON.stringify(grantedScopes.split(' '))); - } - - if (expires_in) { - const expiresInMilliSeconds = expires_in * 1000; - const now = new Date(); - const expiresAt = now.getTime() + expiresInMilliSeconds; - storage.setItem('expires_at', '' + expiresAt); - } -}; - export function setRememberMe(remember: boolean) { removeRememberMe(); localStorage.setItem(storageKey, 'true'); From a43438708426a0738192d1af7079d24b947a2afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20=C3=87A=C4=9EDA=C5=9E?= Date: Thu, 16 Feb 2023 11:30:04 +0300 Subject: [PATCH 27/31] use bash for installing lepton and bootstrap-icons commands --- docs/en/Themes/LeptonXLite/Angular.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/en/Themes/LeptonXLite/Angular.md b/docs/en/Themes/LeptonXLite/Angular.md index 7ebb649aca..56b003e606 100644 --- a/docs/en/Themes/LeptonXLite/Angular.md +++ b/docs/en/Themes/LeptonXLite/Angular.md @@ -14,11 +14,15 @@ To add `LeptonX-lite` into your project, - Install `@abp/ng.theme.lepton-x` -`yarn add @abp/ng.theme.lepton-x@preview` +```bash +yarn add @abp/ng.theme.lepton-x +``` - Install `bootstrap-icons` -`yarn add bootstrap-icons` +```bash +yarn add bootstrap-icons +``` - Then, we need to edit the styles array in `angular.json` to replace the existing style with the new one in the following link : From 2146d84b8fa0cc0c5eacd30b02c2099cd796b4ec Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 17 Feb 2023 09:53:03 +0800 Subject: [PATCH 28/31] Add `AbpStringToGuidConverter` and `AbpNullableStringToGuidConverter`. Resolve #13530 --- .../Mvc/Json/MvcCoreBuilderExtensions.cs | 2 + .../AbpJsonSystemTextJsonModule.cs | 2 + .../AbpNullableStringToGuidConverter.cs | 41 +++++++++ .../AbpStringToGuidConverter.cs | 36 ++++++++ .../ModelBinding/ModelBindingController.cs | 23 +++++ .../ModelBindingController_Tests.cs | 12 +++ .../Volo/Abp/Json/AbpStringToGuid_Tests.cs | 85 +++++++++++++++++++ 7 files changed, 201 insertions(+) create mode 100644 framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpNullableStringToGuidConverter.cs create mode 100644 framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToGuidConverter.cs create mode 100644 framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToGuid_Tests.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs index 9777265abd..4fc5a04859 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs @@ -20,6 +20,8 @@ public static class MvcCoreBuilderExtensions options.JsonSerializerOptions.Converters.Add(new AbpStringToEnumFactory()); options.JsonSerializerOptions.Converters.Add(new AbpStringToBooleanConverter()); + options.JsonSerializerOptions.Converters.Add(new AbpStringToGuidConverter()); + options.JsonSerializerOptions.Converters.Add(new AbpNullableStringToGuidConverter()); options.JsonSerializerOptions.Converters.Add(new ObjectToInferredTypesConverter()); options.JsonSerializerOptions.TypeInfoResolver = new AbpDefaultJsonTypeInfoResolver(serviceProvider diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs index 50dd47d9e2..f6ef46a4e7 100644 --- a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs +++ b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs @@ -22,6 +22,8 @@ public class AbpJsonSystemTextJsonModule : AbpModule options.JsonSerializerOptions.Converters.Add(new AbpStringToEnumFactory()); options.JsonSerializerOptions.Converters.Add(new AbpStringToBooleanConverter()); + options.JsonSerializerOptions.Converters.Add(new AbpStringToGuidConverter()); + options.JsonSerializerOptions.Converters.Add(new AbpNullableStringToGuidConverter()); options.JsonSerializerOptions.Converters.Add(new ObjectToInferredTypesConverter()); options.JsonSerializerOptions.TypeInfoResolver = new AbpDefaultJsonTypeInfoResolver(serviceProvider diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpNullableStringToGuidConverter.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpNullableStringToGuidConverter.cs new file mode 100644 index 0000000000..c80e5aa9a5 --- /dev/null +++ b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpNullableStringToGuidConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Volo.Abp.Json.SystemTextJson.JsonConverters; + +public class AbpNullableStringToGuidConverter : JsonConverter +{ + private JsonSerializerOptions _writeJsonSerializerOptions; + + public override Guid? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType == JsonTokenType.String) + { + var guidString = reader.GetString(); + string[] formats = { "N", "D", "B", "P", "X" }; + foreach (var format in formats) + { + if (Guid.TryParseExact(guidString, format, out var guid)) + { + return guid; + } + } + } + + if (reader.TryGetGuid(out var guid2)) + { + return guid2; + } + + return null; + } + + public override void Write(Utf8JsonWriter writer, Guid? value, JsonSerializerOptions options) + { + _writeJsonSerializerOptions ??= JsonSerializerOptionsHelper.Create(options, this); + var entityConverter = (JsonConverter)_writeJsonSerializerOptions.GetConverter(typeof(Guid?)); + + entityConverter.Write(writer, value, _writeJsonSerializerOptions); + } +} diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToGuidConverter.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToGuidConverter.cs new file mode 100644 index 0000000000..586e4462cf --- /dev/null +++ b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToGuidConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Volo.Abp.Json.SystemTextJson.JsonConverters; + +public class AbpStringToGuidConverter : JsonConverter +{ + private JsonSerializerOptions _writeJsonSerializerOptions; + + public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType == JsonTokenType.String) + { + var guidString = reader.GetString(); + string[] formats = { "N", "D", "B", "P", "X" }; + foreach (var format in formats) + { + if (Guid.TryParseExact(guidString, format, out var guid)) + { + return guid; + } + } + } + + return reader.GetGuid(); + } + + public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options) + { + _writeJsonSerializerOptions ??= JsonSerializerOptionsHelper.Create(options, this); + var entityConverter = (JsonConverter)_writeJsonSerializerOptions.GetConverter(typeof(Guid)); + + entityConverter.Write(writer, value, _writeJsonSerializerOptions); + } +} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController.cs index 471d33261a..6dfe3a7281 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController.cs @@ -49,6 +49,12 @@ public class ModelBindingController : AbpController input.Time3.Value.Kind.ToString().ToLower() + "_" + input.InnerModel.Time4.Kind.ToString().ToLower(); } + + [HttpPost("Guid_Json_Test")] + public GuidJsonModel Guid_Json_Test([FromBody] GuidJsonModel input) + { + return input; + } } public class GetDateTimeKindModel @@ -68,3 +74,20 @@ public class GetDateTimeKindModel public DateTime Time4 { get; set; } } } + +public class GuidJsonModel +{ + public Guid UserId { get; set; } + + public Guid UserId2 { get; set; } + + public Guid UserId3 { get; set; } + + public Guid UserId4 { get; set; } + + public Guid UserId5 { get; set; } + + public Guid? TenantId { get; set; } + + public Guid? TenantId2 { get; set; } +} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs index befbd169fa..53bfff8b68 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs @@ -106,6 +106,18 @@ public abstract class ModelBindingController_Tests : AspNetCoreMvcTestBase var resultAsString = await response.Content.ReadAsStringAsync(); resultAsString.ShouldBe($"local_{Kind.ToString().ToLower()}_{Kind.ToString().ToLower()}_local"); } + + [Fact] + public async Task Guid_Json_Test() + { + var guid = Guid.NewGuid(); + var json = $"{{\"UserId\":\"{guid:B}\",\"UserId2\":\"{guid:N}\",\"UserId3\":\"{guid:D}\",\"UserId4\":\"{guid:P}\",\"UserId5\":\"{guid:x}\",\"TenantId\":null,\"TenantId2\":\"\"}}"; + var response = await Client.PostAsync("/api/model-Binding-test/Guid_Json_Test", new StringContent(json, Encoding.UTF8, MimeTypes.Application.Json)); + + response.StatusCode.ShouldBe(HttpStatusCode.OK); + var resultAsString = await response.Content.ReadAsStringAsync(); + resultAsString.ShouldBe($"{{\"userId\":\"{guid:D}\",\"userId2\":\"{guid:D}\",\"userId3\":\"{guid:D}\",\"userId4\":\"{guid:D}\",\"userId5\":\"{guid:D}\",\"tenantId\":null,\"tenantId2\":null}}"); + } } public class ModelBindingController_Utc_Tests : ModelBindingController_Tests diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToGuid_Tests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToGuid_Tests.cs new file mode 100644 index 0000000000..93918b48c1 --- /dev/null +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToGuid_Tests.cs @@ -0,0 +1,85 @@ +using System; +using System.Text.Json; +using Shouldly; +using Volo.Abp.Json.SystemTextJson.JsonConverters; +using Xunit; + +namespace Volo.Abp.Json; + +public class AbpStringToGuid_Tests +{ + [Fact] + public void Test_Read() + { + var options = new JsonSerializerOptions() + { + Converters = + { + new AbpStringToGuidConverter(), + new AbpNullableStringToGuidConverter() + } + }; + + var guid = Guid.Parse("762DDB84-5225-4853-A566-FF0B3AF57585"); + var testClass = JsonSerializer.Deserialize("{" + + $"\"Id\": \"{guid:N}\", " + + $"\"NullableId\": \"{guid:D}\", " + + $"\"NullableId2\": \"{guid:B}\", " + + $"\"NullableId3\": \"{guid:P}\", " + + $"\"NullableId4\": \"{guid:X}\", " + + "\"NullableId5\": \"\", " + + "\"NullableId6\": null}", options); + testClass.ShouldNotBeNull(); + testClass.Id.ShouldBe(guid); + testClass.NullableId.ShouldBe(guid); + testClass.NullableId2.ShouldBe(guid); + testClass.NullableId3.ShouldBe(guid); + testClass.NullableId4.ShouldBe(guid); + testClass.NullableId5.ShouldBeNull(); + testClass.NullableId6.ShouldBeNull(); + } + + [Fact] + public void Test_Write() + { + var options = new JsonSerializerOptions() + { + Converters = + { + new AbpStringToGuidConverter(), + new AbpNullableStringToGuidConverter() + } + }; + + var guid = Guid.Parse("762DDB84-5225-4853-A566-FF0B3AF57585"); + var json = JsonSerializer.Serialize(new TestClass() + { + Id = guid, + NullableId = null, + NullableId2 = guid, + NullableId3 = null, + NullableId4 = guid, + NullableId5 = null, + NullableId6 = guid + }, options); + + json.ShouldBe($"{{\"Id\":\"{guid:D}\",\"NullableId\":null,\"NullableId2\":\"{guid:D}\",\"NullableId3\":null,\"NullableId4\":\"{guid:D}\",\"NullableId5\":null,\"NullableId6\":\"{guid:D}\"}}"); + } + + class TestClass + { + public Guid Id { get; set; } + + public Guid? NullableId { get; set; } + + public Guid? NullableId2 { get; set; } + + public Guid? NullableId3 { get; set; } + + public Guid? NullableId4 { get; set; } + + public Guid? NullableId5 { get; set; } + + public Guid? NullableId6 { get; set; } + } +} From 66ea25d722870491e017463acfb3a418a847ee2a Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Thu, 2 Feb 2023 16:52:37 +0300 Subject: [PATCH 29/31] Add margin-bottom on search-input --- .../identity/src/lib/components/users/users.component.html | 2 +- .../src/lib/components/tenants/tenants.component.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html index 7873adf6ea..91ce6876ef 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html @@ -10,7 +10,7 @@
-
+
-
+
Date: Thu, 2 Feb 2023 17:10:17 +0300 Subject: [PATCH 30/31] All pages change same as Settings pages. That are use AbpPage now. --- .../lib/components/roles/roles.component.html | 75 ++++----- .../lib/components/users/users.component.html | 155 +++++++++--------- .../identity/src/lib/identity.module.ts | 2 + .../components/tenants/tenants.component.html | 103 ++++++------ .../src/lib/tenant-management.module.ts | 2 + .../page-toolbar/page-toolbar.component.html | 2 +- 6 files changed, 161 insertions(+), 178 deletions(-) diff --git a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html index 09dcdb1be3..af51baa372 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html @@ -1,48 +1,38 @@ -
-
-
-
-
{{ 'AbpIdentity::Roles' | abpLocalization }}
-
-
- -
+ +
+
+
-
- -
-
- - - -

{{ (selected?.id ? 'AbpIdentity::Edit' : 'AbpIdentity::NewRole') | abpLocalization }}

-
+ + +

{{ (selected?.id ? 'AbpIdentity::Edit' : 'AbpIdentity::NewRole') | abpLocalization }}

+
- -
- -
-
+ +
+ +
+
- - - {{ - 'AbpIdentity::Save' | abpLocalization - }} - -
+ + + {{ + 'AbpIdentity::Save' | abpLocalization + }} + +
- - + (abpInit)="init(abpPermissionManagement)" + > + + diff --git a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html index 91ce6876ef..0b7db30ace 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html @@ -1,89 +1,83 @@ -
-
-
-
-
{{ 'AbpIdentity::Users' | abpLocalization }}
-
-
- -
-
-
-
-
-
- + + +
+
+
+
+ +
-
- + +
-
- - -

{{ (selected?.id ? 'AbpIdentity::Edit' : 'AbpIdentity::NewUser') | abpLocalization }}

-
+ + +

{{ (selected?.id ? 'AbpIdentity::Edit' : 'AbpIdentity::NewUser') | abpLocalization }}

+
- -
+ + +
+
-
- -
-
-
+
+ +
- - - {{ - 'AbpIdentity::Save' | abpLocalization - }} - -
+ + + {{ + 'AbpIdentity::Save' | abpLocalization + }} + +
- - + [entityDisplayName]="entityDisplayName" + (abpInit)="init(abpPermissionManagement)" + > + + diff --git a/npm/ng-packs/packages/identity/src/lib/identity.module.ts b/npm/ng-packs/packages/identity/src/lib/identity.module.ts index e217a710a0..e6c11d195e 100644 --- a/npm/ng-packs/packages/identity/src/lib/identity.module.ts +++ b/npm/ng-packs/packages/identity/src/lib/identity.module.ts @@ -17,6 +17,7 @@ import { IDENTITY_ENTITY_PROP_CONTRIBUTORS, IDENTITY_TOOLBAR_ACTION_CONTRIBUTORS, } from './tokens/extensions.token'; +import { PageModule } from '@abp/ng.components/page'; @NgModule({ declarations: [RolesComponent, UsersComponent], @@ -30,6 +31,7 @@ import { NgbDropdownModule, PermissionManagementModule, NgxValidateCoreModule, + PageModule, ], }) export class IdentityModule { diff --git a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html index 2aeb5f5b4a..bb0a27a6b2 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html +++ b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html @@ -1,63 +1,55 @@ -
-
-
-
-
{{ 'AbpTenantManagement::Tenants' | abpLocalization }}
-
-
- -
-
-
+ -
-
-
- + +
+
+
+
+ +
-
- + +
-
- - -

- {{ + + +

+ {{ (selected?.id ? 'AbpTenantManagement::Edit' : 'AbpTenantManagement::NewTenant') | abpLocalization - }} -

-
+ }} +

+
- -
- -
-
+ +
+ +
+
- - - {{ - 'AbpTenantManagement::Save' | abpLocalization - }} - -
+ + + {{ + 'AbpTenantManagement::Save' | abpLocalization + }} + + - - + [(visible)]="visibleFeatures" + providerName="T" + [providerKey]="providerKey" + > + + diff --git a/npm/ng-packs/packages/tenant-management/src/lib/tenant-management.module.ts b/npm/ng-packs/packages/tenant-management/src/lib/tenant-management.module.ts index 1aca283a29..535ee38aaa 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/tenant-management.module.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/tenant-management.module.ts @@ -16,6 +16,7 @@ import { TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, } from './tokens/extensions.token'; +import { PageModule } from '@abp/ng.components/page'; @NgModule({ declarations: [TenantsComponent], @@ -28,6 +29,7 @@ import { NgbDropdownModule, FeatureManagementModule, UiExtensionsModule, + PageModule, ], }) export class TenantManagementModule { diff --git a/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/page-toolbar/page-toolbar.component.html b/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/page-toolbar/page-toolbar.component.html index dc481700d4..e60ed6695f 100644 --- a/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/page-toolbar/page-toolbar.component.html +++ b/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/page-toolbar/page-toolbar.component.html @@ -1,6 +1,6 @@
From 9b3b1519252cbb0c14c39cb3e4cf71cf68486db9 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 20 Feb 2023 11:55:28 +0300 Subject: [PATCH 31/31] Update lepton x on package.json --- templates/app-nolayers/angular/package.json | 2 +- templates/app/angular/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/app-nolayers/angular/package.json b/templates/app-nolayers/angular/package.json index 6a1077b772..8db88c765c 100644 --- a/templates/app-nolayers/angular/package.json +++ b/templates/app-nolayers/angular/package.json @@ -20,7 +20,7 @@ "@abp/ng.setting-management": "~7.0.1", "@abp/ng.tenant-management": "~7.0.1", "@abp/ng.theme.shared": "~7.0.1", - "@abp/ng.theme.lepton-x": "~2.0.0-rc.4", + "@abp/ng.theme.lepton-x": "~2.0.2", "@angular/animations": "^15.0.1", "@angular/common": "^15.0.1", "@angular/compiler": "^15.0.1", diff --git a/templates/app/angular/package.json b/templates/app/angular/package.json index 4872476d1e..3dbb2c7424 100644 --- a/templates/app/angular/package.json +++ b/templates/app/angular/package.json @@ -20,7 +20,7 @@ "@abp/ng.setting-management": "~7.0.1", "@abp/ng.tenant-management": "~7.0.1", "@abp/ng.theme.shared": "~7.0.1", - "@abp/ng.theme.lepton-x": "~2.0.0-rc.4", + "@abp/ng.theme.lepton-x": "~2.0.2", "@angular/animations": "^15.0.1", "@angular/common": "^15.0.1", "@angular/compiler": "^15.0.1",