Activities of "raif"

Hi, I have created a separate database for each tenant in order to provide data isolation between host and tenant in my system. Migration operation is performed over different contextes

Host is

    /* Include modules to your migration db context */
    builder.ConfigurePermissionManagement();
    builder.ConfigureSettingManagement();
    builder.ConfigureBackgroundJobs();
    builder.ConfigureAuditLogging();
    builder.ConfigureIdentity();
    builder.ConfigureIdentityServer();
    builder.ConfigureFeatureManagement();
    builder.ConfigureLanguageManagement();
    builder.ConfigureSaas();
    builder.ConfigureTextTemplateManagement();
    builder.ConfigureBlobStoring();
    /* Custom platform modules */         
    builder.ConfigureCredit();
    /* Configure your own tables/entities inside the ConfigureNMM method */
    builder.ConfigureNMM();

Tenat is

    builder.ConfigurePermissionManagement();
    builder.ConfigureSettingManagement();
    builder.ConfigureAuditLogging();
    builder.ConfigureIdentity();
    builder.ConfigureFeatureManagement();
    builder.ConfigureLanguageManagement();
    builder.ConfigureTextTemplateManagement();

As you can see from above we didn't create any identityServer4 related table at tenant side since it is host related task

As far as i can see out of box app client supports password grant flow

   CreateClientAsync(
    name: consoleAndAngularClientId,
    scopes: commonScopes,
    grantTypes: new[] { "password", "client_credentials", "authorization_code" },
    secret: (configurationSection["XYZ_App:ClientSecret"] ?? "1q2w3e*").Sha256(),
    requireClientSecret: ~~false~~ true,
    redirectUri: webClientRootUrl,
    postLogoutRedirectUri: webClientRootUrl,
~~corsOrigins: new[] { webClientRootUrl.RemovePostFix("/") ~~

Ofcourse, there is no problem for the host users

However tenant users are not able get token for the API calls, Any hint ?

  • ABP Framework version: v4.2.1
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Thx, Missed one of the underscore,

HeaderTenantResolveContributor: Tries to find current tenant id from HTTP headers. The header name is __tenant by default.

  • ABP Framework version: v4.2.1
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes

https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services

Hello, I want to override the method in the application service which in a seperate module.

using Volo.Saas.Editions;
using Volo.Saas.Host.Dtos;
using Volo.Saas.Tenants;

namespace Volo.Saas.Host
{
    [Authorize(SaasHostPermissions.Tenants.Default)]
    public class TenantAppService : SaasHostAppServiceBase, ITenantAppService
    {
        public TenantAppService(.........
        )

        [Authorize(SaasHostPermissions.Tenants.Create)]
        public virtual async Task<SaasTenantDto> CreateAsync(SaasTenantCreateDto input)
        {
        }
    }
}

I'm just targeting to override CreateAsync in my solution

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(ITenantAppService), typeof(TenantAppService), typeof(NMMTenantAppService))]
public class NMMTenantAppService : TenantAppService
{
    public NMMTenantAppService(
        IEditionRepository editionRepository, 
        ITenantRepository tenantRepository, 
        ITenantManager tenantManager, 
        IDataSeeder dataSeeder)
        : base(
              tenantRepository: tenantRepository, 
              editionRepository: editionRepository, 
              tenantManager: tenantManager, 
              dataSeeder: dataSeeder)
    {

    }

    public async override Task<SaasTenantDto> CreateAsync(SaasTenantCreateDto input)
    {
        var tenant = await TenantManager.CreateAsync(input.Name, input.EditionId);
        input.MapExtraPropertiesTo(tenant);
        await TenantRepository.InsertAsync(tenant);

        await CurrentUnitOfWork.SaveChangesAsync();

        return ObjectMapper.Map<Tenant, SaasTenantDto>(tenant);
    }
}

Beside that I'm also not happy with** SaasTenantCreateDto**. Tricky part is I don't want to extend DTO, I want to remove properties What is the recommended way to do this in framework ?

Do I need create a new ApplicationService in my project with new interface ? And replace service from module with a new one

App Service

[Authorize(SaasHostPermissions.Tenants.Default)]
public class NMMTenantAppService : SaasHostAppServiceBase, INMMTenantAppService
{
}

Method

[Authorize(SaasHostPermissions.Tenants.Create)]
public async Task<SaasTenantDto> CreateAsync(**NMMSaasTenantCreateDto** input)
{

}

Interface

public interface INMMTenantAppService : ICrudAppService<SaasTenantDto, Guid, GetTenantsInput, **NMMSaasTenantCreateDto**, SaasTenantUpdateDto>
{

}

Dto

public class NMMSaasTenantCreateDto : SaasTenantCreateOrUpdateDtoBase
{
}

Is there any posibility that we can add attribute which prevents serialization of property ? How can i remove attribute from property ?

public static class NMMApplicationContractsExtensionConfigurator
{
    private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();

    public static void Configure()
    {
        OneTimeRunner.Run(() =>
        {
            ConfigureProperties();
        });
    }
    
    private static void ConfigureProperties()
    {
        ObjectExtensionManager.Instance.AddOrUpdateProperty<SaasTenantCreateDto, string>("AdminEmailAddress",
             options =>
             {
                 options.Attributes.Add(new System.Text.Json.Serialization.JsonIgnoreAttribute());
                 options.Attributes.Remove(new StringLengthAttribute(256));
                 options.Attributes.Add(new StringLengthAttribute(3)
                 {
                     MinimumLength = 1
                 }
             );
        });
     }
}

Definition done at PreConfigure step

public override void PreConfigureServices(ServiceConfigurationContext context)
{
    NMMApplicationContractsExtensionConfigurator.Configure();
} 

However, still able to pass validation, that means i couldn't change DTO properties

Thx for the response. Please consider my comment as feedback. Volo.Saas.Host Tenant app service has create method which includes user data seeding operation.

public virtual async Task<SaasTenantDto> CreateAsync(SaasTenantCreateDto input)
{
	var tenant = await TenantManager.CreateAsync(input.Name, input.EditionId);
	input.MapExtraPropertiesTo(tenant);
	await TenantRepository.InsertAsync(tenant);

	await CurrentUnitOfWork.SaveChangesAsync();

	using (CurrentTenant.Change(tenant.Id, tenant.Name))
	{
		//TODO: Handle database creation?

		await DataSeeder.SeedAsync(
			new DataSeedContext(tenant.Id)
				.WithProperty("AdminEmail", input.AdminEmailAddress)
				.WithProperty("AdminPassword", input.AdminPassword)
		);
	}

	return ObjectMapper.Map<Tenant, SaasTenantDto>(tenant);
}

And it automatically assumes that all tenants use a shared database which is not the %100 cases. In my case i would like assign seperate database for each tenant and method seeds users to the host AbpUsers table.

Beside that DTO has no property about connection string apart from admin email and password which is also not cool

I think it would be better if you leave the workflow of the database seed operation to the developers.But ofc it may depend logical reason which is not able to understand yet. It just feedback

Another question is I am sure that I have removed the TENANTAPPSERVICE and TENANTCONTROLLER from registered service.

Why swagger still listing volo.saas.host.tenant endpoints ? I also don't use ConventionalControllers.Create method in my HttpApiHostModule. Any hint ?

Good job about those Auto Api Controller and documentation https://docs.abp.io/en/abp/latest/API/Auto-API-Controllers cheers

However my IQ level is not high enough to get it first glance

  • ABP Framework version: v4.2.1
  • UI type: MVC
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes

I'm getting an error from the jquery.timeago client library which is the popups with application template. Any idea ?

Steps to reproduce the issue:

  • clear existing node_modules folder
  • clear wwwroot folder (removed only libs)
  • edit package.json, replace existing lepton theme with "@volo/abp.aspnetcore.mvc.ui.theme.commercial": "~4.2.1"
  • npm install
  • run gulp to move files from node_modules to wwwroot

edit package.json, replace existing lepton theme with "@volo/abp.aspnetcore.mvc.ui.theme.commercial": "~4.2.1"

Why do you do this?
they dependencies is different, which will cause the problems you mentioned above.

https://www.npmjs.com/package/@volo/abp.aspnetcore.mvc.ui.theme.lepton https://www.npmjs.com/package/@volo/abp.aspnetcore.mvc.ui.theme.commercial

Why i have to use @volo/abp.aspnetcore.mvc.ui.theme.lepton Is it like mandatory ? even if i don't use lepton theme should we get it ?

Infact I'm not instrested any client side package. I just created my theme based on shared and commercial packages. I'm just trying to fulfill shared and commercial package requirements.

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v4.2.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • 2021-03-15 13:19:27.882 +03:00 [ERR] Invalid object name 'AbpBlobContainers'. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpBlobContainers'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Volo.Abp.BlobStoring.Database.EntityFrameworkCore.EfCoreDatabaseBlobContainerRepository.FindAsync(String name, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.BlobStoring.Database.DatabaseBlobProvider.GetOrCreateContainerAsync(String name, CancellationToken cancellationToken) at Volo.Abp.BlobStoring.Database.DatabaseBlobProvider.SaveAsync(BlobProviderSaveArgs args) at Volo.Abp.BlobStoring.BlobContainer.SaveAsync(String name, Stream stream, Boolean overrideExisting, CancellationToken cancellationToken) at Volo.Abp.BlobStoring.BlobContainerExtensions.SaveAsync(IBlobContainer container, String name, Byte[] bytes, Boolean overrideExisting, CancellationToken cancellationToken) at Siemens.Odms.FileAppService.SaveBlobAsync(SaveBlobInput saveBlobInput) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Siemens.Odms.FileController.SaveBlobAsync(SaveBlobInput saveBlobInput) at lambda_method3887(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
  • Steps to reproduce the issue:

Configure blobstoring model creation with table prefix

builder.ConfigureBlobStoring(optionsAction: options => { options.TablePrefix = "Any prefix apart from Abp"; options.Schema = dbSchema; });

Maybe i'm blind as bat but not able to locate Volo.Abp.BlobStoring.Database.EntityFrameworkCore ? or anything related with Volo.Abp.BlobStoring.Database blob provider ?

Showing 1 to 10 of 54 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11